As the title says, can I use Windows (7) to resize the ext4 partition Ubuntu is installed on? I dual-boot both Win7 and Ubuntu and want to enlarge the Ubuntu root partition. Is it safe to do this from Windows which does not recognize the ext4 filesystem, but sees the partition, or will I have to boot from a (sloooow) Ubuntu live-DVD?
Ubuntu – Will resizing ext4 partitions with Windows destroy the installed Ubuntu
ext4partitioningwindows
Best Answer
There are really two issues here:
People mostly refer to "resizing the partition" because that implies also resizing the filesystem, but in the case of your question, understanding the answer requires understanding the distinction between the two.
Partitions are very simple data structures that define the start and end points of chunks of the disk. Filesystems, by contrast, are complex data structures that are defined relative to the start of the data structures that contain them. Note that a filesystem is conventionally contained by a partition, but it could be contained in a file, on a whole disk, in an LVM's logical volume, etc.
Because filesystems are laid out relative to their starting point, it's possible to safely move the end point of a partition upward even if the tools used to do this don't understand the filesystem. It's also completely pointless to do this, since the filesystem's own data structures will not magically expand to fill the available space. Moving the end point of the partition down is likely to be disastrous, since important files might be stored at the end of the filesystem -- and even if they aren't, the filesystem data structures will still indicate that the filesystem is the same size it originally was, so the OS might try to store files beyond the (new) end of the partition, which will be disastrous. Moving the start point of a partition without adjusting the filesystem will be even more disastrous, since then the OS won't be able to detect the filesystem at all. (Note that I've used the word "disastrous" three times in this paragraph, not counting in this parenthetical statement.)
Similarly, it's possible to shrink a filesystem without doing any damage to it (assuming the shrinking operation works correctly, which is not guaranteed), but it will then be smaller than its containing partition. Growing it (if it's already properly sized for its containing partition) is impossible -- or at least, any competently-written tool will refuse to do so.
I haven't checked the source code, but chances are GParted relies on underlying tools to resize the partition and filesystem separately, but in the correct order to keep things accessible and proper. For instance, to grow a partition from the end, it would increase the partition size and then increase the filesystem size to match.
Getting back to your question, there are certainly Windows tools that can resize partitions. In theory, an ext4fs resizing tool could be written for Windows. In fact, it's conceivable that
resize2fs
(the tool that does the job in Linux) has already been ported to Windows. If so, you could do the job from Windows -- but AFAIK, there's no easy-to-use GUI front-end for the job. Thus, I don't recommend even trying. It actually is possible to resize an ext4fs partition while it's in use, but only if the start point is not moved. This also requires using text-mode commands. In most cases it's easier (and safer, especially for relative novices) to use a live medium to run GParted.Also, the slowness of a DVD-based Ubuntu is a trivial thing compared to the risks and, depending on what you're doing, the time involved in resizing a partition. In particular, if you move the start point of a partition, that will take a lot of time, since such an operation involves moving a lot of data.
As an alternative, you might consider creating a new partition from the space you use in shrinking the one(s) you want to shrink. Once you know the size, you can move some existing data there and mount the new partition in your Ubuntu directory tree. See, for instance:
How can I move my /home directory to another partition if it's already part of the / partition?
Depending on the sizes,
/home
might not be the best thing to move; you might end up moving/var
,/home/yourname/Videos
, or something else, but the principle's the same.