Re: Move directory from one partition/device to another

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

 



Cameron Beattie wrote:
> How do I now convince the system to look in /dev/sda2/newetc/etc rather
> than /dev/sdb1/etc when I do a cd /etc?

Les Mikesell replied:
> Errr....  You did read the part above that you quoted above noting
> that /etc was a special case that needs to be on the / partition
> didn't you? 

Cameron said:
> I did read it and I understood it to be difficult but not impossible. So I'm
> now attempting to do the difficult and failing!

Actually, I'm not convinced /etc/fstab is the biggest problem. The big
problem is init (the first process on a Unix-like system and the
ultimate parent of everything else), which wants to read /etc/inittab.
Linux assumes that they will be on the root filesystem.

You'd probably want to mess around with this on a scratch filesystem.

One option would be to give the scratch filesystem /sbin/init,
/etc/inittab, some sort of shell, and a shell script somewhere apart
from /etc. You'd also need a few device nodes: either udev, a static
/dev, or something temporary somewhere else. And you'd need a
non-modular kernel or enough kernel modules for your purposes.

That should get a Linux system booted as far as loading init and running
the shell script. The shell script would then have to
mount -t ext3 /dev/sda2 /etc/ (which would hide the original
/etc/inittab), do an init q (to get init to re-read /etc/inittab), and
then keep going.

Alternatively, I suspect that the early boot stuff in initrd could be
hacked to mount two filesystems at start-up, not just one. It would have
to do much the same stuff as I outlined above.

Cameron, that's how you might get it done if you really wanted to. It
*really* wouldn't be easy, and you might well be accomplishing something
that No-one Has Done Before in the history of Unix-like operating
systems. So your best option in to learn, and to experiment. Learn what
all the things I've mentioned are, and what they do. Experiment: try
creating a Linux boot-time environment. Learn how everything works.
Learn how to make it give error messages, and how to work out what they
mean. Learn to rejoice when it *still* doesn't boot, but it's got one
stage further.  And try and work out what your next stage will be.

And, I'm afraid, don't expect much help from outside.

There might be some value in all this for certain security-oriented
systems: If /home, /tmp/, /var, /dev, and /etc are mounted from separate
filesystems [1], everything else should be mountable read-only. This
should minimise the chances of root filesystem errors, and the chance
that anyone can install rootkits.

James.

[1] You may want to do something about root's home directory, too.
-- 
E-mail address: james |  ... more holes in Internet Explorer than
@westexe.demon.co.uk  | Blackburn, Lancashire...
                      |     -- http://theinquirer.net/?article=17235


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux