Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
This is to grow the partition. The use of pivot_root makes sense with the use of a rescue cd, and it explains why all of the questions I've found on google mention using a rescue cd. The partition has been resized already (using lvm2) and we are using ext3. The concern I am getting from above is the safety of doing it online, since, as I said, this process is to be used on production machines. –  Matthew Dec 14 '11 at 20:57
    
yes, pivot_root in this situation requires that you've bootstrapped a new / (basically a separate install) on some other partition. it would be cumbersome. –  stew Dec 14 '11 at 20:59
    
I understand your trepidation about an online resize. I do believe it is pretty safe. I know it is only anecdotal, but I've done it dozens of times. I've had it refuse to operate with old filesystems, but never cause data loss / corruption. –  stew Dec 14 '11 at 21:00
    
I think I'm going to give the online resize a go-ahead. Luckily we're still in testing in QA, and the prod boxes aren't actively used (yet), so there are very few people using the boxes. That should reduce any complications (knock on wood). Thanks for the advice! –  Matthew Dec 14 '11 at 21:07
    
The pivot_root to tmpfs is not that hard, it worked really well for me to unmount and resize a root filesystem that didn't allow online resize. Can even do it without a reboot (but I rebooted to clean up at the end). This guy wrote a howto: ivarch.com/blogs/oss/2007/01/… but it can be even easier. You have to know what you're doing! I have a remote console (prgmr.com service), so no need to keep ssh or the network up. Didn't copy anything from /usr so only 150MB RAM neede for tmpfs. telinit u to restart init so it lets go of the old root. –  Sam Watkins Oct 17 '13 at 3:35
show 1 more comment

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.