In gparted, why can’t I modify partitions that are in use, like root, but in Windows I can shrink the root partition while booted into it.
Is there any program I can use to modify a partition while it’s in use?
In gparted, why can’t I modify partitions that are in use, like root, but in Windows I can shrink the root partition while booted into it.
Is there any program I can use to modify a partition while it’s in use?
GParted is pretty conservative about this, but it can be done with other tools; however, there are significant differences depending on the partitioning method (conventional partitions vs. LVM) and the filesystem in use. For instance:
lvresize
; but the filesystems they contain may still need to be resized separately. (Sometimes the --resizefs
option to lvresize
will help with this task, though.)pvmove
followed by vgreduce
). If you've got one big PV, you'll need to resize it with pvresize
and then adjust the containing partition's size with fdisk
, parted
, gdisk
, or some other tool.resize2fs
to do this job. This tool supports increasing or decreasing the size of unmounted filesystems; but for mounted filesystems, the size can be increased but not decreased. For other filesystems, you must consult the filesystem's own sizing tools.system-config-lvm
can help with LV resizing when using LVM.I don't use the Windows tools very often; however, my vague recollection is that, when you resize an in-use Windows partition, its tools require a reboot as part of the operation. If this recollection is correct, then the Linux and Windows tools actually aren't all that different from a low-level point of view; it's just that Windows helps automate the different steps involved, whereas you must explicitly do the different things yourself under Linux. In some cases, such as when increasing the size of an LV, Linux may actually be more flexible than Windows.
The why of it has to do with the way the data structures are created and otherwise manipulated by the kernel; the kernel tends to assume that partitions that are in use won't change in size. That said, I'm not familiar with the internal kernel details, just some of the system calls that partitioning tools can use to tell the kernel to update its partition-table data. There have also been changes to how the kernel handles this from time to time; but such changes require changes to userspace tools that may take a while to propagate. GParted is itself built on numerous other levels (most notably libparted, but also GUI libraries, the X Window System, etc.), so it can be slow to catch up to new features at the kernel level.
There are numerous questions and answers on this site that cover numerous specific resizing scenarios. Covering them all in a single answer would be tedious and impractical.