How can I shrink/resize a non-LVM ext4 root partition?

The problem is I can't unmount it and I don't have physical access.

  • for ext4, the answer is no. And what non-LVM has anything to do with ext4? – daisy Oct 31 '12 at 10:20

ext4 does not support online shrinking. You can not shrink an ext4 volume without unmounting it (with or without LVM). If the problem is that this is your rootfs, you may be able to do the shrink from initramfs—depends on if you have console access (e.g., IP KVM).

If instead you wish to grow it, that's doable, provided you have free space after the partition. Basically, you recreate the partition, making absolutely certain that you keep the start position the same, but making the length longer. And of course, you should keep a copy of the old partition table around just in case. Then, in order to get the kernel to reread the partition table, you'll have to reboot. You can then use resize2fs as normal. You should think carefully if this is really what you want to do, especially on a machine you don't have physical access to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.