Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Technical Support _ Shrink linux partition

Posted by: Emir Mar 27 2017, 04:31 AM

Hello to all,
I have problem with shrinking Linux partition.
My hdd is 400Gb and it is only 51% full, so I want to shrink it under 300GB. I have tried to use Gprted but there is not option to shrink it, because it see it as full. I have tried to use resize2fs, but I was unable to unmount partition.

This is what I got with df:

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
442747752 213475988 206804396 51% /
tmpfs 16438680 0 16438680 0% /dev/shm
/dev/sda1 487652 106862 355190 24% /boot

Posted by: michaelk Mar 27 2017, 11:20 AM

Your using LVM which is different from a regular partition so regular tools will not work. You might want to google to find out how it works. First question is what do you want to do with the free space?

It helps to know the distribution/version but we need to know the filesystem type of your root logical volume. Look at the output of the lsblk or mount command but it probably is either xfs or ext4. If it is xfs then there isn't a good or easy way to reduce the size.

Many installers create by default a boot partition and a LVM partition that contains the / filesystem and swap. The LVM partition is just a container for the volume group/logical volumes. Assuming your root LV is ext4 you need to boot a live CD/USB.

Basic steps:
1. resize root LV
2. resize volume group
3. resize LVM partition.

Posted by: DeeWelch Jul 31 2017, 12:22 AM

QUOTE (michaelk @ Mar 27 2017, 11:20 AM) *
Your using LVM which is different from a regular partition so regular tools will not work. You might want to google to find out how it works. First question is what do you want to do with the free space?

It helps to know the distribution/version but we need to know the filesystem type of your root logical volume. Look at the output of the lsblk or mount command but it probably is either xfs or ext4. If it is xfs then there isn't a good or easy way to reduce the size.

Many installers create by default a boot partition and a LVM partition that contains the / filesystem and swap. The LVM partition is just a container for the volume group/logical volumes. Assuming your root LV is ext4 you need to boot a live CD/USB.

Basic steps:
1. resize root LV
2. resize volume group
3. resize LVM partition.


So that's how is it. Thanks buddy!

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)