Unmounting the root filesystem (/) for resizing without a rescue cd?

I am just trying to figure out if this is possible to do. I am trying to resize a number of filesystems, and to be safe (these are production boxes as well as QA) I wanted to do the resize offline.

I have gotten into the server with single user mode and am having no issues unmounting /var, and /opt. However I cannot unmount /.

Any ideas would be appreciated, using a rescue cd is not an option.


Solution 1:

You certainly cannot unmount / ; you could perhaps first pivot_root to another / then umount the previous /, but there always has to be a /, and you cannot unmount a filesystem in use (and if it is /, it must be in use).

Are you needing to grow or shink the partition? Some filesystems (such as ext2/ext3/ext4) will allow online growing, but not necessarily shrinking. (using resize2fs). You'd have to resize the partition from underneath the filesystem first.

This is all to be considered dangerous, and it would be wise to have a full backup before starting.