File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes Create directory under root (/)? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Reply Bookmark "Create directory under root (/)?" Watch "Create directory under root (/)?" New topic
Author

Create directory under root (/)?

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 664
Is it proper to create a new directory under root directory (/) and store all my juck stuff such as jdk, tomcat etc in it? Some how I don’t want to use /home/user.
In windows system we can freely create directories under C:.


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Bruce - My $.02 - it depends on how you have designed the physical layout of your disk(s) and the mount points you assign. All usually done during install.
If you have one massive partition where / is mounted, then sure. But note that in this case, there is little diference between installing things under /, /home, /opt, .... whatever.
OTOH, if you have multiple partitions mapped to different mount points, e.g. /, /boot, /home, /opt, /usr, etc. each mounted on a different disk/partition - then it is somewhat of a 'disk space' decision - i.e. which of your partitions is less/more full than others.
I like to put miscellaneous stuff under /opt, but that is sure not a requirement. There are lots of other options, including new directories under / or even /misc.
There are some directories which *must* be mounted under /. /etc for sure, and maybe /lib (not sure about that).
If you show me the output of:
df -m
I might be able to give you some concrete advice for your situation.
Regards, Guy
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12510

It's considered good practice to avoid excessive use of "/" as a home for things. For one thing, you directory structure should qualify things, and obviously if something has no parent, there's nothing to describe it.
For specifics, the "standard" places to put the jdk are in /usr/java/ and for tomcat /var/tomcatX (3 or 4). Commercial packages are encourages to use /opt, other apps often end up in /usr/local (my JDK did until I started using Sun RPMs).
There's a standard of sorts for this stuff that Linux vendors are moving towards. You might want to track it down.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 664
Thank you Guy and Tim:
1.The reason I want to create a directory under “/” and store all my stuff (jdk, tomcat etc) under it is that I hope to back up everything in 1 tar file. In case of complete system fail, I can simply restore everything using this tar file. I do not know if this is a good plan. I do not know if jdk will work without going through the jdk installation process.
2.Partitions and mount points concepts are still new to me. I installed Mandrake by following default set ups. I just bought Vicki Stanfield’s book “Linux System Administration”. It seems to be a good book and I am trying to read it.
3.df –m output is:
Filesystem1M-blocksUsedAvailableuse%Mounted on
/dev/hda1 779 531 20872/
/dev/hda6 587 109 44820/home
[ March 06, 2002: Message edited by: Bruce Jin ]
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Bruce - think of partitions/mount points as .... well in Win terms, you would have a C: drive, a D: drive , etc.
In your situation, you have 2 HD partitions, one mounted at / the other at /home.
You are installing 'stuff' under /. It is currently aboout 68% full (of 779MB).
Your /home parition is 18% full (of 587MB).
Where are you going to put 'stuff' when the / mount point is, say 95% full? (Well, one can always boot a PM rescue floppy and jerk the sizes around - I've done that!)

I agree that /usr or /usr/local or /opt are more usual places than /, ..... well, the bottom line is, you are the SA of your system. If it works for you then it is OK!
Maintaining a Linux system for you and you alone is very different than maintaining one for 20 or 30 users!!
Happy Linuxing, Guy
P.S. - I'd also add that your backup plan is reasonable at your stage of the game. You could dump the tar to another machine or to CD for insurance.
[ March 06, 2002: Message edited by: Guy Allard ]
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 664
Thank you Guy for the explanation!
My Linux is a servlet server. I will connect it to the Web soon. I am the only one who is using it.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
Don't forget that even with only two "partitions", you can still split different directories across different parts of the disk. You should check up on "symbolic links". For example One of my systems has most of the disk allocated to /home, but I have /opt as a symbolic link to /home/opt so it doesn't take up space in /.


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Frank is definitely right about symlinks. They are nice magic. Much more powerful than Windows shortcuts.
Just be a little careful until you are sure you understand them.
G.
 
 
subject: Create directory under root (/)?
 
Threads others viewed
How to debug a servlet
Web application deployment
About the position of tld files
where is my web application root?
How to run jsp on TOMCAT?
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture