Recent Articles

The Patent Ploy
Microsoft to Offer Sales Support for Novell's Suse Linux... Huh? Did I hear that right? Yep, there it is again: Linux to work with Windows.

Terrasoft Supplying Linux for PS3
Is it really news when Terrasoft announces that it will be supplying Linux for the PS3?

Zeroconf
I liked the last paragraph of Carla Schroder's "Run Zeroconf for Linux in a Snap"

Red Hat Falls On Sharp Numbers
A disappointing second quarter for the Linux distributor met with fierce retribution from shareholders in trading.

Linux: The Flash And The Fish
Flash Player 9 for Linux made its public debut (finally) at a controlled demonstration during a conference. Meanwhile, a number of people have suggested ways that Ubuntu Christian Edition will work for its users.

Educators Push Linux Switch In India
Microsoft received a swift punch to the gut from an Indian state government looking to lower education costs by encouraging its school system to switch...

Linux pinfo
I have never liked Linux "info". The reason is simple enough: I don't like Emacs, and "info" uses an emacs style interface.

Death of the Command Line
It's hard for me to imagine using an OS without a strong command line. Even Microsoft has recognized the...


11.22.06


Controlling Disk Space W/ Symbolic Links

By A.P. Lawrence

I've covered this in other articles here, but when I went searching for something to point a customer at I had a little trouble finding it, so we'll do it here:

Let's say you have a system with a few filesystems. One of those systems is getting tight on space, but the other has plenty of room. You want to add a large amount of data, but it has to be in the file system that's low on space. For example, it's /home that is low on space, and it's /home/fred/drwaings that needs more room.

There are several ways to handle that. First you could just move that "drawings" directory to /bigdrive/drawings and leave it at that. Any scripts that use /home/fred/drawings would need to be updated and any users who need access would have to get used to looking on /bigdrive. You could also just move all of fred: ~fred could now be /bigdrive/users/fred or whatever. If only Fred used these, that might be an easy solution: move him over, edit /etc/passwd to change his home directory (or use "usermod" to do it for you). Or..

You could use a symbolic link. This method starts by moving "drawings" to /bigdrive as before:

mv /home/fred/drawings /bigdrive/drawings

And then:

ln -s /bigdrive/drawings /home/fred/drawings

For almost all uses, this is entirely transparent: no scripts need to be modified, no users need to be notified or retrained. Any action that accesses /home/fred/drawings will end up accessing /bigdrive/drawings instead. Well, almost any action - "ls -l" does work slightly differently after the move:

# before the link
$ ls -l drawings
total 53776
-rw-r--r-- 1 apl wheel 17086 Nov 12 09:46 01-04-06_0537.jpg
-rw-r--r-- 1 apl wheel 42590 Nov 12 09:46 12-28-05_0521.jpg
-rw-r--r-- 1 apl wheel 48270 Nov 12 09:46 12-28-05_1038.jpg
-rw-r--r-- 1 apl wheel 39134 Nov 12 09:46 12-28-05_1042.jpg
-rw-r--r-- 1 apl wheel 39138 Nov 12 09:46 12-28-05_1043.jpg
-rw-r--r-- 1 apl wheel 41874 Nov 12 09:46 12-28-05_1044.jpg
-rw-r--r-- 1 apl wheel 41578 Nov 12 09:45 12-28-05_1045.jpg
etc.
# after the link
$ ls -l drawings
lrwxr-xr-x 1 apl apl 9 Nov 22 08:10 tfoo -> /bigdrive/drawings


Low Rate eCommerce & Retail Plans

Also, "rm" won't complain if you just "rm /home/fred/drawings": it won't warn about this being a directory - but it doesn't remove /bigdrive/drawings, just the symbolic link in /home/fred. But watch out: some Unixes have slightly different treatments - see Different symbolic link behaviour.

But there's nothing else that would confuse a script or program ordinarily. A program can determine that it has crossed a symbolic link if it wants to, but there's seldom any reason to, so you are unlikely to have any issues.

Symbolic links can be confusing if you are running around with "cd". The issue is this: if you were sitting in /home/fred and then did "cd drawings", and you then "cd ..", where are you? Will "pwd" show /home/fred or /bigdrive?

Well, it depends on your shell and perhaps some environment variables. For example, with Bash, you could "set -P" to make "cd" follow the physical path for symbolic links. You can also just say "cd -P" or "cd -L" to have specific control if necessary.

Mac OS X has symbolic links, but it also has something similar called aliases that have some features symbolic links do not.

Way back when, Microsoft MSDOS had something that was a little bit like a Unix symbolic link. Actually, it was a way to "mount" drives, but they called it "JOIN". For example, you could "JOIN D: C:\NEWDRIVE", and then if you "CD \NEWDRIVE" you'd be sitting on D:. Hardly anybody ever used this, but it has been there just the same (there's a Unix "join" also, but that's a database like command that merges files based on a common key- see "man join").

*Originally published at APLawrence.com


About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

About LinuxProNews
LinuxProNews is a collection of news and commentary designed to keep you in step with the ever evolving landscape of Linux environments. Opensource News and Advice for Linux Professionals

LinuxProNews is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com DevWebPro.com


-- LinuxProNews is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2006 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article



Opensource News and Advice for Linux Professionals LinuxProNews News Archives About Us Feedback LinuxProNews Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact