Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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.
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.
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.
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
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.
-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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.