LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-18-2004, 11:53 PM   #1
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
/etc on another partition


Is it possible to have the /etc directory on a different partition than what root is mounted on? The reason being that I have a root FS mounted on /dev/ram (the system runs from RAM), but I want to have /etc on a directory on the disk so that system changes won't get wiped with a reboot.

But since fstab itself is in /etc, I don't know how to do it. I have read that the "bind" command might be the answer, but I can't find to much info on it.

Anybody have any ideas?
 
Old 03-19-2004, 01:15 AM   #2
shubb
Member
 
Registered: Oct 2003
Location: San Francisco
Distribution: Slackware 13.37
Posts: 150

Rep: Reputation: 16
Are you booting from a CD or a floppy? There has to be a fstab somewhere to know where to mount stuff. You would probably have to edit that file.

Last edited by shubb; 03-19-2004 at 01:23 AM.
 
Old 03-19-2004, 02:46 AM   #3
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
its possible, but it wont be overly easy, in example: /etc/fstab has a list of FS's and devices and were to mount them, etc, and usually the boot-up scripts tell mount something like "mount -avw", you'd have to replace that with the mount command being called for every FS that needs to be mounted/remounted

so unless you no nothing about init's boot-up scripts and the mount command and stuff like that, best to leave it alone.... unless you want to learn that is
 
Old 03-19-2004, 02:33 PM   #4
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Original Poster
Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
It boots from a disk image I created to start off of a Compact Flash card.

There has to be a fstab somewhere to know where to mount stuff. You would probably have to edit that file.

But then how is the kernel going to find the file? I can put in HDA5 for /etc in fstab, but the kernel is not going to be able to find it since the fstab file itself isn't where it is supposed to be (it would be in HDA5).

I was thinking I could have just the fstab file in /etc in the initrd image, then have the fstab file bind /dev/hda5 to /etc (hda5 would already contain all of the files that are supposed to be in /etc). But I don't know if that would work. Experimentation is a pain, because every change I make means I have to create and compress a new initrd and write it to the CF card (the initrd in this case is the entire Linux system, not just a minimal startup system), which isn't fun to say the least, so I am trying to eliminate the guess work here.

This is for a line of embedded network devices I am developing, so I would appreciate not getting blown off, by the way.
 
Old 03-19-2004, 11:28 PM   #5
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
I'm not so sure it would be a problem.

As soon as the filesystems are mounted the /etc partition would be mounted over the root filesystems /etc and will remain so. Any changes will be intact on the next boot.

There would be a few things required like a correct fstab on the ramdisk but once it's setup your /etc partition should be there right after init mounts the filesystems.


Give it a try, I think it would be a good idea.

Last edited by DavidPhillips; 03-19-2004 at 11:31 PM.
 
Old 03-20-2004, 12:15 AM   #6
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
As far as I'm concerned, you could put /etc on whatever partition you wanted to, as long as your fstab correctly referenced it. Same deal with any other partition -- J.W.
 
Old 03-20-2004, 01:09 AM   #7
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
you don't even need fstab . programs like mount use it to know were partitions are, but you can also tell mount all the required info, it would mean having to rewrite parts of the boot scripts (depending on how big your distro is, it could mean replacing 1 line with a few, or spending hours finding that 1 line .. just be careful if /var is on another partition, as it could make your system freeze when syslogd is ran.. it is possible to go around it tho, just a few more lines of boot scripts editing
 
Old 03-21-2004, 11:03 PM   #8
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Original Poster
Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
OK, I created a new disk image with a /etc directory containing only the fstab file which directed the system to mount hda5 as /etc.

This did not work and the system complained about not finding inittab.

So my question is, at what point does the system actually read the fstab file? Since every file the system reads before fstab is going to have to be in the ramdisk, and everything else is going to have to be on hda5.

I would just include the entire /etc in the ramdisk, but since this is an embedded system, space is a concern.
 
Old 03-22-2004, 03:41 AM   #9
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
heres the boot procedure

-computer get power
-BOIS loads and runs
-BOIS calls boot device
-boot device loads a different larger boot program
-boot program loads kernel
-kernel decompresses
-kernel loads
-kernel calls init
-init calls /etc/inittab to know what to do (inittab contains a list of definitions on the runlevels, what is default, and what programs to run
-init executes boot up script (declared in /etc/inittab)
-init enters default runlevel (declared in /etc/inittab) and exectures that runlevels scripts (also declared in /etc/inittab)
-init executes programs declared in /etc/inittab (usually some getty program so you can login
-getty logs you on using login program
-bash starts and executes its .bashrc file (at least it should!) as well as referring to /etc/profile to set up global settings

ok, the mounting of the file systems should happen when init runs the boot script (at least it will remount the root partition,), if not then it will be done in the runlevel scripts, usually it looks something like:
mount -a
meaning mount everything (-a means all) referred to in /etc/fstab , so its not a required file, but the boot up scripts will be (well, at least the first boot script thats called on init's boot up)
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy files from partition to partition too slow, SATA hard disk.What should I do£¿ Ryanlee SUSE / openSUSE 20 10-31-2005 07:30 AM
Deleted ntfs partition - added linux partition in its place - corrupt! eklhad Linux From Scratch 2 06-28-2005 01:31 AM
Total partition size - User partition size is not equals to Free partition size navaneethanj Linux - General 5 06-14-2004 12:55 PM
How do I install slackware on a partition made by partition magic in windows bling bling Slackware 4 06-28-2003 11:16 PM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration