[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to switch root file system?



Steve Kieu wrote:
> How can I do that? can I do a
> 
> chroot /mnt/loop /sbin/init
> 
> or chroot /mnt/loop /bin/bash

These will probably work (I've never chrooted and ran init; if init is
already running it won't work). But they do leave behind that unsightly
original root fs. Even if you can't see it, you'll know it's there, eh?

Check out the man page for pivot_root. This utility allows you to swap
in a new root filesystem. The old root filesystem remains mounted at
/mnt or somewhere like that in the new root, and can be cleanly
unmounted even. It's quite handy.

-- 
see shy jo



Reply to: