|
|
| Next: [Samba] Windows 7 |
| Author |
Message |
Phil B External

Since: Oct 26, 2009 Posts: 4
|
Posted: Mon Oct 26, 2009 6:10 pm Post subject: /etc/fstab query Archived from groups: alt>os>linux (more info?) |
|
|
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.
That raises a chicken and egg situation in my mind:
/etc/fstab defines which partitions are to be mounted and what's on them.
How then does the system at boot time (would it be the kernel?) find /etc?
Phil |
|
| Back to top |
|
 |
John Hasler External

Since: Oct 26, 2009 Posts: 8
|
Posted: Mon Oct 26, 2009 6:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Phil B writes:
> How then does the system at boot time (would it be the kernel?) find
> /etc?
/etc has to be on the root partition.
--
John Hasler
jhasler DeleteThis @newsguy.com
Dancing Horse Hill
Elmwood, WI USA |
|
| Back to top |
|
 |
Aragorn External

Since: Feb 22, 2009 Posts: 13
|
Posted: Mon Oct 26, 2009 7:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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
> them.
> How then does the system at boot time (would it be the kernel?) find
> /etc?
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
filesystem.
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.
--
*Aragorn*
(registered GNU/Linux user #223157) |
|
| Back to top |
|
 |
Grant External

Since: Feb 26, 2009 Posts: 22
|
Posted: Mon Oct 26, 2009 7:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Mon, 26 Oct 2009 21:33:23 -0000, "Phil B" <phil.remove.brady@hotmail dot co dot united kingdom> 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 /.
Something like:
move /etc/lib/mythtv/* to temp location (maybe tarball?)
umount /etc/lib
mount </etc/lib partiton> to /mnt
move /mnt/* to /etc/lib
umount /mnt
mkdir /etc/lib/mythtv
mount <old /etc/lib partition> /etc/lib/mythtv
move (temp /etc/lib/mythtv/* files) /etc/lib/mythtv
edit /etc/fstab
Done! (?)
Grant.
--
http://bugsplatter.id.au |
|
| Back to top |
|
 |
Unruh External

Since: May 27, 2005 Posts: 2213
|
Posted: Mon Oct 26, 2009 8:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
"Phil B" <phil.remove.brady@hotmail dot co dot united kingdom> writes:
>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 /.
mkdir /etc/libnew
rsync -av --exclude=**/mythtv/ /etc/lib/ /etc/libnew
umount /etc/lib ; rmdir /etc/lib; mv /etc/libnew /etc/lib
and you are done. Note that you have now lost the /etc/lib/mythtv since
it is not mounted anywhere. I am not sure what you wanted done with it.
Now edit /etc/fstab and remove the /etc/lib mount line.
You do not have to reboot or use a live partition, unless /etc/lib
contains absolutely crucial libraries that bash, mv, rm or rmdir use.
>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.
>That raises a chicken and egg situation in my mind:
>/etc/fstab defines which partitions are to be mounted and what's on them.
>How then does the system at boot time (would it be the kernel?) find /etc?
/etc HAS to be on the / partition. It finds it by the fact that / is
automatically mounted and in grub or lilo the system is told which the /
partition is. The / partition MUST contain /etc/ and /lib, and /bin.
Those cannot be on a separate partition.
I have no idea what you have in /etc/lib, but it must not be stuff
crucial to the boot. |
|
| Back to top |
|
 |
Phil B External

Since: Oct 26, 2009 Posts: 4
|
Posted: Tue Oct 27, 2009 4:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
"Phil B" <phil.remove.brady@hotmail dot co dot united kingdom> wrote in
message news:wpGdnernhos8iHvXnZ2dnUVZ8v2dnZ2d@bt.com...
>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.
>
> That raises a chicken and egg situation in my mind:
> /etc/fstab defines which partitions are to be mounted and what's on them.
> How then does the system at boot time (would it be the kernel?) find
> /etc?
>
> Phil
>
>
Thanks for your helpful replies everyone.
Actually, I misquoted the tree I want to manipulate - it is /var/lib,
but that still holds stuff which needs to be open like the logs.
Sorry, but it was a long day yesterday!
Phil |
|
| Back to top |
|
 |
Phil B External

Since: Oct 26, 2009 Posts: 4
|
Posted: Tue Oct 27, 2009 4:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
"Phil B" <phil.remove.brady@hotmail dot co dot united kingdom> wrote in
message news:wpGdnernhos8iHvXnZ2dnUVZ8v2dnZ2d@bt.com...
>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.
>
> That raises a chicken and egg situation in my mind:
> /etc/fstab defines which partitions are to be mounted and what's on them.
> How then does the system at boot time (would it be the kernel?) find
> /etc?
>
> Phil
>
Thanks for your helpful replies everyone.
Actually, I misquoted the tree I want to move - it's /var/lib but
your comments are still relevant. Sorry - it was a long day yesterday!
Phil |
|
| Back to top |
|
 |
Phil B External

Since: Oct 26, 2009 Posts: 4
|
Posted: Tue Oct 27, 2009 4:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
"Phil B" <phil.remove.brady@hotmail dot co dot united kingdom> wrote in
message news:wpGdnernhos8iHvXnZ2dnUVZ8v2dnZ2d@bt.com...
>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.
>
> That raises a chicken and egg situation in my mind:
> /etc/fstab defines which partitions are to be mounted and what's on them.
> How then does the system at boot time (would it be the kernel?) find
> /etc?
>
> Phil
>
>
Thanks for your helpful replies everyone.
Actually, I misquoted the tree I want to move - it's /var/lib but
your comments are still relevant. Sorry - it was a long day yesterday!
Phil |
|
| Back to top |
|
 |
Unruh External

Since: May 27, 2005 Posts: 2213
|
Posted: Tue Oct 27, 2009 5:10 pm Post subject: Re: /etc/fstab query [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
"Phil B" <phil.remove.brady@hotmail dot co dot united kingdom> writes:
>"Phil B" <phil.remove.brady@hotmail dot co dot united kingdom> wrote in
>message news:wpGdnernhos8iHvXnZ2dnUVZ8v2dnZ2d@bt.com...
>>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.
>>
>> That raises a chicken and egg situation in my mind:
>> /etc/fstab defines which partitions are to be mounted and what's on them.
>> How then does the system at boot time (would it be the kernel?) find
>> /etc?
>>
>> Phil
>>
>>
>Thanks for your helpful replies everyone.
>Actually, I misquoted the tree I want to manipulate - it is /var/lib,
>but that still holds stuff which needs to be open like the logs.
/var/lib does not have logs. That is /var/log.
>Sorry, but it was a long day yesterday!
>Phil |
|
| Back to top |
|
 |
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
| |
|
|