Re: /etc/fstab query
- From: Aragorn <aragorn@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 26 Oct 2009 23:10:35 +0100
On Monday 26 October 2009 22:33 in alt.os.linux, somebody identifying as
Phil B wrote...
A silly question.
I want to move a directory tree from one partition to another on my
mythbuntu system as I think it will make backup easier. It will also
be a good exercise for this novice.
Specifically, it currently has /etc/lib on a separate partition from
/, and I want to move all of it except /etc/lib/mythtv back to the
partition holding /.
I plan to mount the partitions under a live distro then mv the
directories to the right partitions, then edit /etc/fstab to reflect
the changes. I'll be doing it on a 'spare' drive so no real grief if I
mess it up.
There's a way to do it without a live CD as well. Just "mount --bind"
the root filesystem to - say - */mnt* and then copy the contents of the
regularly mounted */etc/lib* filesystem to the */etc/lib* directory on
the bind-mounted root filesystem - this would then be */mnt/etc/lib.*
Next, you unmount the bind-mounted root filesystem and the separate
*/etc/lib* filesystem, but be careful here as something may actually be
using files on that filesystem, so it's best to do it from single-user
maintenance mode, i.e. runlevel 1.
That raises a chicken and egg situation in my mind:
/etc/fstab defines which partitions are to be mounted and what's on
How then does the system at boot time (would it be the kernel?) find
The bootloader passes the filesystem designated as the root filesystem
to the kernel. When the kernel is decompressed in memory - which is
after the processor has been switched into protected mode (or long mode
on x86-64) - the boot parameters and such are copied from low memory to
high memory so the kernel will still have access to that information
once the low memory that was used by the realmode code - i.e.
bootloader and kernel bootstrapping code - has been cleared out.
If you've got a kernel that uses an /initrd,/ it will load its driver
modules from there, and if it's a kernel built to boot without
an /initrd/ it'll have the necessary drivers built-in for directly
accessing the root filesystem - other drivers may then still be loaded
as modules, as long as the kernel knows where to find them, and this
would be the */lib/$(uname -r)/modules* directory on the known root
Now, the root filesystem was specified as a boot option in the
bootloader and this information copied to where the kernel can access
it once it has decompressed. The kernel will then check this root
filesystem for errors, and if none are found, it will launch
*/sbin/init* - this is hardcoded into the kernel as a default, but can
be overridden with a boot parameter, as is done to boot up into
single-user maintenance mode.
Once /init/ starts running - at this stage, userspace is already
active - it starts forking off some processes which take care of the
the mounting of the filesystems as specified in */etc/fstab* and the
starting of the necessary daemons for the default runlevel.
So to put a long story short: the kernel doesn't actually look for
*/etc* at boot, but it does look for the directories */lib* - if it
needs to load modules directly off of the root filesystem - and
*/sbin,* both residing on the filesystem of which it was made clear by
the bootloader that this is the root filesystem to use, and /init/
takes care of the rest.
(registered GNU/Linux user #223157)
- /etc/fstab query
- From: Phil B
- /etc/fstab query
- Prev by Date: Re: /etc/fstab query
- Next by Date: Re: /etc/fstab query
- Previous by thread: Re: /etc/fstab query
- Next by thread: Re: /etc/fstab query