Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
for ext4, the answer is no. And what non-LVM has anything to do with ext4? –  warl0ck Oct 31 '12 at 10:20

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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