my /boot is not in lvm, I read that I need to
- shrink logical volume
- shrink physical volume
- resize partition
I think I successfully did step 2, but stuck there, as Free PE seems disappears after a while, and I don’t understand why. Following commands are executed inside F38 live cd
[root@localhost-live liveuser]# parted /dev/sdb print
Model: ATA TS256GMTS400 (scsi)
Disk /dev/sdb: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 170GB 170GB lvm
3 170GB 170GB 345MB fat32 Basic data partition boot, esp
4 170GB 170GB 268MB ext4 Basic data partition msftdata, no_automount
5 170GB 256GB 85.8GB No name
[root@localhost-live liveuser]# fdisk -l
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WDC WD5000LPLX-0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x2efb7eca
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 976769023 976766976 465.8G 7 HPFS/NTFS/exFAT
Disk /dev/sdb: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: TS256GMTS400
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2251A347-06EB-4214-BAD1-0D779497D354
Device Start End Sectors Size Type
/dev/sdb1 2048 331298815 331296768 158G Linux LVM
/dev/sdb3 331298816 331972607 673792 329M EFI System
/dev/sdb4 331972608 332496895 524288 256M Microsoft basic data
/dev/sdb5 332496896 500117503 167620608 79.9G unknown
Disk /dev/mapper/fedora-root: 237.9 GiB, 255441502208 bytes, 498909184 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
GPT PMBR size mismatch (4100491 != 7856126) will be corrected by write.
The backup GPT table is not on the end of the device.
Disk /dev/sdc: 3.75 GiB, 4022337024 bytes, 7856127 sectors
Disk model: Cruzer Blade
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 596BFE18-6CFC-4880-BA94-298703C7C362
Device Start End Sectors Size Type
/dev/sdc1 64 4075983 4075920 1.9G Microsoft basic data
/dev/sdc2 4075984 4099827 23844 11.6M EFI System
/dev/sdc3 4099828 4100427 600 300K Microsoft basic data
Disk /dev/loop0: 1.85 GiB, 1987653632 bytes, 3882136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 7.57 GiB, 8128561152 bytes, 15876096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop2: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/live-rw: 7.57 GiB, 8128561152 bytes, 15876096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/live-base: 7.57 GiB, 8128561152 bytes, 15876096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/zram0: 8 GiB, 8589934592 bytes, 2097152 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
[root@localhost-live liveuser]# lvresize -L -256M --resizefs /dev/mapper/fedora-root
fsck from util-linux 2.38.1
/dev/mapper/fedora-root: Inode 4195745 extent tree (at level 1) could be shorter. IGNORED.
/dev/mapper/fedora-root: Inode 4200788 extent tree (at level 1) could be shorter. IGNORED.
/dev/mapper/fedora-root: Inode 4328013 extent tree (at level 1) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 4365074 extent tree (at level 1) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 4719171 extent tree (at level 1) could be shorter. IGNORED.
/dev/mapper/fedora-root: Inode 4719351 extent tree (at level 1) could be shorter. IGNORED.
/dev/mapper/fedora-root: Inode 4721912 extent tree (at level 1) could be shorter. IGNORED.
/dev/mapper/fedora-root: Inode 4744249 extent tree (at level 1) could be shorter. IGNORED.
/dev/mapper/fedora-root: Inode 4981078 extent tree (at level 2) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 5112223 extent tree (at level 2) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 5113032 extent tree (at level 2) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 5113059 extent tree (at level 1) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 5113089 extent tree (at level 1) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 5113121 extent tree (at level 2) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 5113210 extent tree (at level 2) could be narrower. IGNORED.
/dev/mapper/fedora-root: Inode 5118973 extent tree (at level 1) could be narrower. IGNORED.
/dev/mapper/fedora-root: 1391744/15597568 files (1.4% non-contiguous), 25851215/62363648 blocks
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/mapper/fedora-root to 62298112 (4k) blocks.
The filesystem on /dev/mapper/fedora-root is now 62298112 (4k) blocks long.
Size of logical volume fedora/root changed from <237.90 GiB (60902 extents) to <237.65 GiB (60838 extents).
Logical volume fedora/root successfully resized.
[root@localhost-live liveuser]# e2fsck -f /dev/sdb4
e2fsck 1.46.5 (30-Dec-2021)
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
boot: 102/65536 files (2.0% non-contiguous), 227467/262144 blocks
[root@localhost-live liveuser]# resize2fs /dev/sdb4
resize2fs 1.46.5 (30-Dec-2021)
The filesystem is already 262144 (1k) blocks long. Nothing to do!
[root@localhost-live liveuser]# pvdisplay -v -m
--- Physical volume ---
PV Name /dev/sdb5
VG Name fedora
PV Size <79.93 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 20461
Free PE 0
Allocated PE 20461
PV UUID QhFeDm-FZsC-ZThg-qbse-SKXv-yYuc-8obe87
--- Physical Segments ---
Physical extent 0 to 20460:
Logical volume /dev/fedora/root
Logical extents 0 to 20460
--- Physical volume ---
PV Name /dev/sdb1
VG Name fedora
PV Size 157.97 GiB / not usable 2.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 40441
Free PE 64
Allocated PE 40377
PV UUID JK7m9H-XWbv-MjT0-NId7-t2zo-wA3z-QIWdP7
--- Physical Segments ---
Physical extent 0 to 40376:
Logical volume /dev/fedora/root
Logical extents 20461 to 60837
Physical extent 40377 to 40440:
FREE
[root@localhost-live liveuser]# pvresize /dev/sdb1 --setphysicalvolumesize 161512
/dev/sdb1: Requested size <157.73 GiB is less than real size 157.97 GiB. Proceed? [y/n]: y
WARNING: /dev/sdb1: Pretending size is 330776576 not 331296768 sectors.
Physical volume "/dev/sdb1" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
as you can see above , I have Free PE 64
, but even though I have not done anything , I just opened gparted, blivet-gui and gnome disks to check info in a gui, the Free PE is 0 now, and I can not resize partition
latest info
# vgdisplay -v
--- Volume group ---
VG Name fedora
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size <237.65 GiB
PE Size 4.00 MiB
Total PE 60838
Alloc PE / Size 60838 / <237.65 GiB
Free PE / Size 0 / 0
VG UUID cbwDRa-Grcd-H65X-l8ub-vbNc-y9aC-SO8H1X
--- Logical volume ---
LV Path /dev/fedora/root
LV Name root
VG Name fedora
LV UUID eNmKl8-mo04-dGnf-I8lc-eSRt-wDFP-PWaWrg
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-04-06 18:27:50 -0700
LV Status available
# open 1
LV Size <237.65 GiB
Current LE 60838
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Physical volumes ---
PV Name /dev/sdb5
PV UUID QhFeDm-FZsC-ZThg-qbse-SKXv-yYuc-8obe87
PV Status allocatable
Total PE / Free PE 20461 / 0
PV Name /dev/sdb1
PV UUID JK7m9H-XWbv-MjT0-NId7-t2zo-wA3z-QIWdP7
PV Status allocatable
Total PE / Free PE 40377 / 0
# pvdisplay
--- Physical volume ---
PV Name /dev/sdb5
VG Name fedora
PV Size <79.93 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 20461
Free PE 0
Allocated PE 20461
PV UUID QhFeDm-FZsC-ZThg-qbse-SKXv-yYuc-8obe87
--- Physical volume ---
PV Name /dev/sdb1
VG Name fedora
PV Size <157.73 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 40377
Free PE 0
Allocated PE 40377
PV UUID JK7m9H-XWbv-MjT0-NId7-t2zo-wA3z-QIWdP7
# vgs
VG #PV #LV #SN Attr VSize VFree
fedora 2 1 0 wz--n- <237.65g 0
# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 fedora lvm2 a-- 157.72g 0
/dev/sdb5 fedora lvm2 a-- <79.93g 0