Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Linux

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 10-26-2009, 01:40 PM
Phil B
Newsgroup Contributor
 
Posts: n/a
/etc/fstab query

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 10-26-2009, 01:40 PM
  #2 (permalink)  
Old 10-26-2009, 02:00 PM
John Hasler
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query

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@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 10-26-2009, 02:10 PM
Aragorn
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query

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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 10-26-2009, 02:50 PM
Grant
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query

On Mon, 26 Oct 2009 21:33:23 -0000, "Phil B" <phil.remove.brady******** 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 10-26-2009, 03:30 PM
Unruh
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query

"Phil B" <phil.remove.brady******** 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.





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #6 (permalink)  
Old 10-27-2009, 11:10 AM
Phil B
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query


"Phil B" <phil.remove.brady******** 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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #7 (permalink)  
Old 10-27-2009, 11:10 AM
Phil B
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query


"Phil B" <phil.remove.brady******** 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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #8 (permalink)  
Old 10-27-2009, 11:10 AM
Phil B
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query


"Phil B" <phil.remove.brady******** 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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #9 (permalink)  
Old 10-27-2009, 12:10 PM
Unruh
Newsgroup Contributor
 
Posts: n/a
Re: /etc/fstab query

"Phil B" <phil.remove.brady******** dot co dot united kingdom> writes:


>"Phil B" <phil.remove.brady******** 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



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SP2 query... ross m. greenberg Windows Vista 3 06-15-2009 07:30 AM
fstab and ntfs-3g heavytull Linux 5 03-27-2008 02:30 PM
RE: QUERY JimmiBoi Windows XP 3 01-04-2007 04:27 AM
Re: QUERY lurkswithin Windows XP 0 01-04-2007 04:23 AM
Query Capt K Ripendran Windows XP 6 01-04-2007 04:20 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 05:42 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0