I have a physical Redhat RHEL 6.10 machine on physical hardware, which I tried to virtualize for vmware. We did backup with dd to virtualize. Problem is right now, that this VM is still taking full 146GB-SAS-Disk of dataspace (original), but real data takes only 27GB of diskspace.
I resized the logical volume of partition /dev/mapper/vg_sb00681-lv_root and /dev/mapper/vg_sb00681-lv_home with command resize2fs and lvreduce (like described here: https://www.linuxtechi.com/reduce-size-lvm-partition/) of root-Parition to 20GB and home-Partition to 5GB. As you can see, partitions are shrinked. Still no problem.
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_sb00681-lv_root 20G 9.8G 8.9G 53% / tmpfs 931M 0 931M 0% /dev/shm /dev/sda1 477M 105M 347M 24% /boot /dev/mapper/vg_sb00681-lv_home 4.8G 1.5G 3.2G 32% home
Now, with GParted I'm not able to free the free space on LVM partition.
If I tried to shrink/move partition, it ends in GParted with error. Error Message:
shrink file system lvm pvresize -v --yes --setphysicalvolumesize 34433024K '/dev/sda2' 0 physical volume(s) resized or updated / 1 physical volume(s) not resized Archiving volume group "vg_sb00681" metadata (seqno 32). WARNING: /dev/sda2: Pretending size is 68866048 not 285650944 sectors. Resizing volume "/dev/sda2" to 68866048 sectors. Resizing physical volume /dev/sda2 from 34869 to 8406 extents. /dev/sda2: cannot resize to 8406 extents as later ones are allocated.
So I tried with pvmove to move physical extents to the end of physical volume. It gaves me free disk space between the physical volumes and I'm not able to pack free space together to the end. I've no idea what the next steps are and if it is possible to reduce partition on VM to save disk space.
ubuntu@ubuntu:-$ sudo pvs -v --segments /dev/sda2 PV VG Fmt Attr PSize PFree Start SSize LV Stat Type PE Ranges /dev/sda2 vg_sb00681 lvm2 a-- <136.21g 103.37g 0 2006 lv_swap 0 linear /dev/sda2:0-2005 /dev/sda2 vg_sb00681 lvm2 a-- <136.21g 103.37g 2006 16812 0 free /dev/sda2 vg_sb00681 lvm2 a-- <136.21g 103.37g 18818 5120 lv_root 0 linear /dev/sda2:18818-23937 /dev/sda2 vg_sb00681 lvm2 a-- <136.21g 103.37g 23938 1280 lv_home 0 linear /dev/sda2:23938-25217 /dev/sda2 vg_sb00681 lvm2 a-- <136.21g 103.37g 25218 9651 0 free
Does somebody has any idea or a hint for me?