0

I'm trying to reduce the size of a partition in a Centos 10 system. I created a bootable thumb drive with Gparted, but it showed no space available to reduce the partition.

So I tried resizing the largest filesystem from 1.8 to 1.7 GB using the resize2fs command, and that worked.

However, GPartd still shows the same partition size, and I'm still unable to reduce it.

According to GParted, the partition name is:

/dev/md126p2. The filesystem is lvm2_pv.

The mount point is vg_contos6svr.

The other partition name is /dev/md126p1.

The df -h command shows /dev/md126p1, but not /dev/md126p2.

The file system I reduced is named: /dev/mapper/vg_contos6svr_lv_mysql

and it's mounted on /var/lib/mysql.

I need to fit the entire image into a 1848.1TB drive (actually two drives as it's a RAID 0 as set up in the BIOS).

GParted says /dev/md126p2 is 1.86 TB. So I just need to have the partition size reflect the file system change.

How do I do that? I'm not clear if it's do-able without destroying the image, but it would be great if possible.

  • There are more steps required to reduce the LVM. After un-mounting and running resize2fs, you still need to reduce the size using lvreduce command. However, you will need to be careful as this can destroy data if you reduce too much. – Peter Hauge Aug 11 '21 at 03:36
  • Run df -H to verify its a EXT partition. Also see if you have enough space available before running the lvreduce command. https://www.linuxtechi.com/reduce-size-lvm-partition/ – Peter Hauge Aug 11 '21 at 03:45
  • Hi, I've run the lvreduce command, looks like it worked. Now I'm trying to reduce the lvgroup by using the pvresize command. But that's giving an error message about "cannot resize to 405999 extents as later onese are allocated". Now I'm trying to figure out how to use the pfmove command. I'm not quite grasping the concept - I think I need to move the free space space which is after lv_mysql but before lv_root, lv_swap and lv_home to be somewhere after those last 3. It's confusing and there aren't many examples. – Jack BeNimble Aug 11 '21 at 03:56

0 Answers0