[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to Rezize Partition on LVM



El 23/10/15 a las 20:05, ray escribió:
I would like to resize the /home partition but it is mounted, and when umount is run, it errors with 'busy'.

System Configuration:
I installed jessie on a laptop with one SSD.  I used guided partitioning and selected the whole drive with multiple partitions.  The /home now takes up 420 GB.  I would like to reduce that to 20 GB to make room for another partition.

What are the methods reduce this partition?

In order to resize a partition that is on LVM, you must *first* reduce the size of the filesystem, *then* reduce the size of the logical volume, to exactly the same size (or the LVM LV bigger than the filesystem, but that is wasteful and does not make sense). To make sure that the LVM LV and filesystem are the same size, specify the size to all tools in bytes to be sure. Instead of using a bigger unit like MB or MiB. Make the conversion and make it a multiple of 1 MiB, for example, if you want 400 GB, rounding to the nearest multiple of 1 MiB gives 400000286720 bytes.

To shrink a filesystem, you will need to use a filesystem-specifc tool. For ext{2,3,4} you can use "resize2fs"; the filesystem needs to be unmounted in order to make it smaller, but you can make a filesystem bigger either mounted or unmounted mounted (but this is the opposite you need in this case).

To resize a logical volume, take a look into the documentation (man page) of the tool "lvresize".

The only requirement that will cause a minor inconvenience is to have your partition unmounted. Since you want to resize /home, it will normally be used by many programs, including your desktop environment; and therefore there is no trivially easy way to unmount it while using your graphical environment.

You should be able to boot in single user mode and do the resizing with /home unmounted. I have not done that in Debian 8 yet (which a different boot system by default than Debian 7).

You can also boot from a Live CD image of Debian and perform the resizing from there; however, there is no need to burn the image to an actual CD, and it is a waste of resources (money and natural resources) unless it is actually required for a different and good reason. Instead, put the CD image as a file into your root partition and boot from there using GRUB. There is plenty of information about how to boot an ISO image from GRUB in its manual and scattered in the web. For example, with a very quick search I found this: <http://xmodulo.com/boot-iso-image-from-grub.html>; do your own research.

A web search will bring more information about resizing in general. Resizing is a common task when installing operating systems. *I heavily recommend against using Google.* Google has way too much power and don't uses it for good (neither it should have that much power in the first place). For example, DuckDuckGo comes pre-configured in Iceweasel; it promises to not to track, and it isn't an Internet tyrant (unlike Google), so consider using it instead.

Standard recommendation of making a backup applies.


Reply to: