0

ubuntu@ubuntu:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 1.8G 1 loop /rofs loop1 7:1 0 87.9M 1 loop /snap/core/5662 loop2 7:2 0 140.9M 1 loop /snap/gnome-3-26-1604/70 loop3 7:3 0 2.3M 1 loop /snap/gnome-calculator/238 loop4 7:4 0 13M 1 loop /snap/gnome-characters/124 loop5 7:5 0 14.5M 1 loop /snap/gnome-logs/45 loop6 7:6 0 3.7M 1 loop /snap/gnome-system-monitor/57 loop7 7:7 0 42.1M 1 loop /snap/gtk-common-themes/701 sda 8:0 0 36.1G 0 disk ├─sda1 8:1 0 731M 0 part ├─sda2 8:2 0 1K 0 part └─sda5 8:5 0 35.4G 0 part sdb 8:16 1 14.5G 0 disk └─sdb1 8:17 1 14.5G 0 part /media/ubuntu/ESD-USB sr0 11:0 1 1.9G 0 rom /cdrom ubuntu@ubuntu:~$ sudo cryptsetup isLuks /dev/sda5 ; echo $? 0 ubuntu@ubuntu:~$ sudo apt-get update && sudo apt-get install lvm2 cryptsetup ubuntu@ubuntu:~$ sudo modprobe dm-crypt ubuntu@ubuntu:~$ sudo vgscan --mknodes ubuntu@ubuntu:~$ sudo vgchange -ay ubuntu@ubuntu:~$ sudo cryptsetup luksOpen /dev/sda5 crypt1 Enter passphrase for /dev/sda5: ubuntu@ubuntu:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 1.8G 1 loop /rofs loop1 7:1 0 87.9M 1 loop /snap/core/5662 loop2 7:2 0 140.9M 1 loop /snap/gnome-3-26-1604/70 loop3 7:3 0 2.3M 1 loop /snap/gnome-calculator/238 loop4 7:4 0 13M 1 loop /snap/gnome-characters/124 loop5 7:5 0 14.5M 1 loop /snap/gnome-logs/45 loop6 7:6 0 3.7M 1 loop /snap/gnome-system-monitor/57 loop7 7:7 0 42.1M 1 loop /snap/gtk-common-themes/701 sda 8:0 0 36.1G 0 disk
├─sda1 8:1 0 731M 0 part
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 35.4G 0 part
└─crypt1 253:0 0 35.4G 0 crypt ├─mint--vg-root 253:1 0 31.4G 0 lvm
└─mint--vg-swap_1 253:2 0 4G 0 lvm
sdb 8:16 1 14.5G 0 disk
└─sdb1 8:17 1 14.5G 0 part /media/ubuntu/ESD-USB sr0 11:0 1 1.9G 0 rom /cdrom ubuntu@ubuntu:~$ sudo pvdisplay -m --- Physical volume --- PV Name /dev/mapper/crypt1 VG Name mint-vg PV Size <35.41 GiB / not usable 2.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 9064 Free PE 5 Allocated PE 9059 PV UUID N6UtLS-GIbd-qf3o-V8s0-2dIa-Z7hM-fzdzKT

--- Physical Segments --- Physical extent 0 to 8035: Logical volume /dev/mint-vg/root Logical extents 0 to 8035 Physical extent 8036 to 9058: Logical volume /dev/mint-vg/swap_1 Logical extents 0 to 1022 Physical extent 9059 to 9063: FREE ubuntu@ubuntu:~$ sudo e2fsck -f /dev/mapper/mint--vg-root e2fsck 1.44.4 (18-Aug-2018) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/mint--vg-root: 286480/2060352 files (0.1% non-contiguous), 1771505/8228864 blocks ubuntu@ubuntu:~$ sudo resize2fs -p /dev/mapper/mint--vg-root 24g resize2fs 1.44.4 (18-Aug-2018) Resizing the filesystem on /dev/mapper/mint--vg-root to 6291456 (4k) blocks. Begin pass 2 (max = 132335) Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 3 (max = 252) Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 4 (max = 23985) Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The filesystem on /dev/mapper/mint--vg-root is now 6291456 (4k) blocks long. ubuntu@ubuntu:~$ sudo e2fsck -f /dev/mapper/mint--vg-root e2fsck 1.44.4 (18-Aug-2018) Pass 1: Checking inodes, blocks, and sizes Inode 79718 extent block passes checks, but checksum does not match extent (logical block 12288, physical block 401916, len 944) Fix? yes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/mint--vg-root: 286480/1569792 files (0.1% non-contiguous), 1739691/6291456 blocks ubuntu@ubuntu:~$ sudo e2fsck -f /dev/mapper/mint--vg-root e2fsck 1.44.4 (18-Aug-2018) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/mint--vg-root: 286480/1569792 files (0.1% non-contiguous), 1739691/6291456 blocks ubuntu@ubuntu:~$ sudo pvdisplay -m --- Physical volume --- PV Name /dev/mapper/crypt1 VG Name mint-vg PV Size <35.41 GiB / not usable 2.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 9064 Free PE 5 Allocated PE 9059 PV UUID N6UtLS-GIbd-qf3o-V8s0-2dIa-Z7hM-fzdzKT

--- Physical Segments --- Physical extent 0 to 8035: Logical volume /dev/mint-vg/root Logical extents 0 to 8035 Physical extent 8036 to 9058: Logical volume /dev/mint-vg/swap_1 Logical extents 0 to 1022 Physical extent 9059 to 9063: FREE

ubuntu@ubuntu:~$ sudo lvreduce -L -10G /dev/mapper/mint--vg/root WARNING: Reducing active logical volume to 21.39 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce mint-vg/root? [y/n]: y Size of logical volume mint-vg/root changed from 31.39 GiB (8036 extents) to 21.39 GiB (5476 extents). Logical volume mint-vg/root successfully resized. ubuntu@ubuntu:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 1.8G 1 loop /rofs loop1 7:1 0 87.9M 1 loop /snap/core/5662 loop2 7:2 0 140.9M 1 loop /snap/gnome-3-26-1604/70 loop3 7:3 0 2.3M 1 loop /snap/gnome-calculator/238 loop4 7:4 0 13M 1 loop /snap/gnome-characters/124 loop5 7:5 0 14.5M 1 loop /snap/gnome-logs/45 loop6 7:6 0 3.7M 1 loop /snap/gnome-system-monitor/57 loop7 7:7 0 42.1M 1 loop /snap/gtk-common-themes/701 sda 8:0 0 36.1G 0 disk
├─sda1 8:1 0 731M 0 part
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 35.4G 0 part
└─crypt1 253:0 0 35.4G 0 crypt ├─mint--vg-root 253:1 0 21.4G 0 lvm
└─mint--vg-swap_1 253:2 0 4G 0 lvm
sdb 8:16 1 14.5G 0 disk
└─sdb1 8:17 1 14.5G 0 part /media/ubuntu/ESD-USB sr0 11:0 1 1.9G 0 rom /cdrom ubuntu@ubuntu:~$ sudo e2fsck -f /dev/mapper/mint--vg-root e2fsck 1.44.4 (18-Aug-2018) The filesystem size (according to the superblock) is 6291456 blocks The physical size of the device is 5607424 blocks Either the superblock or the partition table is likely to be corrupt! Abort? yes ubuntu@ubuntu:~$ sudo pvdisplay -m --- Physical volume --- PV Name /dev/mapper/crypt1 VG Name mint-vg PV Size <35.41 GiB / not usable 2.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 9064 Free PE 2565 Allocated PE 6499 PV UUID N6UtLS-GIbd-qf3o-V8s0-2dIa-Z7hM-fzdzKT

--- Physical Segments --- Physical extent 0 to 5475: Logical volume /dev/mint-vg/root Logical extents 0 to 5475 Physical extent 5476 to 8035: FREE Physical extent 8036 to 9058: Logical volume /dev/mint-vg/swap_1 Logical extents 0 to 1022 Physical extent 9059 to 9063: FREE

ubuntu@ubuntu:~$ sudo pvresize --setphysicalvolumesize 24G /dev/mapper/crypt1 /dev/mapper/crypt1: Requested size 24.00 GiB is less than real size <35.41 GiB. Proceed? [y/n]: y WARNING: /dev/mapper/crypt1: Pretending size is 50331648 not 74256384 sectors. /dev/mapper/crypt1: cannot resize to 6143 extents as 6499 are allocated. 0 physical volume(s) resized / 1 physical volume(s) not resized ubuntu@ubuntu:~$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.