Modify Default Linux Directory Structure

Juniper Netscreen-5gt 10 user 75mbps fir...
October 22, 2010 at 09:29:30
Specs: Ubuntu 10.10, Dual 2.4GHz, 2.5GB

I am in the process of building a custom Linux Distro (All new OS using the Linux Kernel) using "Linux from Scratch". So far everything is going smoothly. My question is if it is possible to modify the default directory structure of Linux. From what I can tell the kernel is the first place I need to focus for this. What I would like to do is create a more like Mac OS X Structure. According to Wikipedia not all distros use the same directory structure so I assume this must be possible. My wanted structure is as follows.</p>

/etc => /system
/bin => /system/bin
/sbin => /system/sbin
/root => /system/root
/var => /system/var
/proc => /system/proc
/lib => /system/library
/dev => /system/devices
/usr => /applications
/home => /users
/mnt => /volumes
/tmp => /temp (or same)
/boot => Stay the same.

I know this structure is quite unrealistic and I know I might only be able to change just a couple directories but Mac OS X did it so I want to do too. I also know that a new structure might cause problems installing linux applications but I plan to deal with this when the time comes.</p>

Joel T Greene


See More: Modify Default Linux Directory Structure

Report •

#1
October 22, 2010 at 13:45:08
No reason to get so involved in this. A lot of the reasons for this came from unix and for reasons that don't exist today.

The drawback to making a non-standard layout is when you install some app. The installer may or may not ask you and put stuff where it wants. That may or may not even matter.

Why did it take me over a year to phone in a problem to ATT?


Report •

#2
October 22, 2010 at 14:51:45
After some searching I came across GoboLinux which has done exactly what I am asking (Sort Of). They have rearranged all the directories in new locations but used Symbolic Links to reference the old directories (For Compatibility). Now I need to know how did they do this??? The creator says he started GoboLinux from the same place I am which is "Linux from Scratch". Interesting. Can someone please shine light of where I need start with this change. I have already created a new partition, built the tools, chrooted to the partition and created my new directory layout (With Symbolic Links) but I really don't want to continue yet. I need to know if any modifications need to be made to the kernel source or such?

Joel T Greene


Report •

#3
October 22, 2010 at 14:54:40
I have been reading in many locations that Linux Developers will admit the downfall of the current directory layout. That is one reason I want to make my own. I guess the question is if the change has to be done in the kernel source. For example /dev, /tmp and /proc.

Joel T Greene


Report •

Related Solutions

#4
October 22, 2010 at 17:33:47
The kernel is independent of the file layout.

If you followed the LFS it ought to work. Saying that is meaningless though. LFS is difficult for many people. Who knows where the slightest typo may bork your new distro. It is why people choose distro's over self made installs.

You will end up learning a lot from this in any case. Consider Gentoo maybe for your next project. A bit easier and tools that let you install and maintain apps better.

Why did it take me over a year to phone in a problem to ATT?


Report •

#5
October 22, 2010 at 19:04:12
Thanks for your concerns but unlike "many people" I am not having a single difficulty with LFS. I got to the part of LFS where it explains the Directory Structure but all says is their layout is FHS Compliment. Bummer!

Joel T Greene


Report •

#6
October 22, 2010 at 20:07:11
You do mean "fhs compliant".

I suggest that you continue on with what you are doing. It is a test and you can either pass it of fail it but will learn in any case.

Why did it take me over a year to phone in a problem to ATT?


Report •

#7
October 23, 2010 at 07:45:36
You're obviosuly familiar with Linux & default directory scheme, so what are you gaining by changing /etc to /system, /bin to /system/bin, & so on? Seems to me all it will do is cause problems.

Report •

#8
October 23, 2010 at 16:07:03
I think he is trying to see how hard of a problem he can make later when some app doesn't work.

Why did it take me over a year to phone in a problem to ATT?


Report •

#9
October 23, 2010 at 20:54:10
The only change I could possibly see needing to be done in the kernel is changing the location of init (by default it should be in /sbin/init). Even this could probably be ignored if you use an initial ramdisk with the traditional file layout. /proc is an in-kernel file system, but I believe it can be mounted in an arbitrary location. This would probably break applications that expect the procfs to be mounted at /proc, but that may be fixable with a symlink.

Report •

#10
October 25, 2010 at 14:54:13
Thanks for all the replies. To all you negative talkers, I am not your average punk kid off the street corner. I have tons of experience not just with Coding which not just includes C, PHP, Java, Basic and More. I was able to to get Frontpage 2003 Extensions running on Ubuntu 9.10 with Apache 2.2 and if anyone is familiar with these extensions they were never officially made compatible with Ubuntu nor Apache 2.2. Sorry, If I sound like I'm mad or something but I am tired of people telling me I can't do something. Its my life and there is a reason the code is made OPEN SOURCE. I'm just asking simple questions so please answer without some smart comment. Thank You.

I don't care about broken apps because this is a learning experience and besides I figure I might be able to build a virtual root structure using chroot or something. But thats a later problem.

My objective is to centralize locations of files, for example why are applications install in more then one location like /bin, /usr/sbin, /usr/local or even /opt. Not to mention the silly /sbin folders. This directory structure has been around since the beginning of UNIX and the problem has just gotten worst as people have built more on top of it.

I have discovered my first thing I have to work with is the Kernel Source. After messing around I got a Bootable Kernel but my first problem is it is throwing a kernel panic over the /dev/root location but I can not seems to change its location inside the source.

Please if anyone has experience with the Kernel Source please I would appreciate your assistance.

Joel T Greene


Report •

#11
October 25, 2010 at 22:04:11
I got a good deal of work done so far and I am very happy with the outcome. I'm at the point of programming where the init comes in to play but I got to ask "What is your favorite init program?". I don't want to use the standard BSD-Style or SysV-Style. Please make a suggestion.

Joel T Greene


Report •

#12
October 26, 2010 at 13:24:27
Start here for that. http://en.wikipedia.org/wiki/Init


Many of the newer distros are trying to speed up boot. Might look at systemd.


Why did it take me over a year to phone in a problem to ATT?


Report •

#13
October 28, 2010 at 17:18:26
That is where I started and runit looked quite interesting. I gave it a try but for some reason it has some holes in it when I want it to boot any type of getty. (agetty, mingetty or just getty)

I took a look at systemd and it dose look interesting the only thing that deterred me the first time was the use of traditional sysV and LSB scripts but if I can not get runit to behave then systemd might have to be my next stop.

Joel T Greene


Report •

Ask Question