Welcome to WebProNews Breaking eBusiness and Search News
Advertise | Newsletter | Sitemap | News Feeds News Feed 
 WebProNews Search Part of the iEntry network iEntry inc. 

Controlling Disk Space W/ Symbolic Links

A.P. Lawrence
Expert Author
Published: 2006-11-22

WebProNews RSS Feed


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


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

Add to Del.icio.us | Digg | Reddit | Furl

Bookmark WebProNews:

View All Articles by A.P. Lawrence



Receive Our Daily Email of Breaking eBusiness News


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

WebProNews RSS Feed

More Expert Articles Articles

Contact WebProNews
Advertisement





TOP NEWS

Targeted Information for Business
WebProNews is part of the iEntry network

Internet Business: Marketing: Small Business:
WebProNews MarketingNewz SmallBusinessNewz
WebProWorld AdvertisingDay PromoteNews
EcommNewz SalesNewz EntrepreneurNewz

Software: Search Engines: Web Design:
WebMasterFree Jayde B2B DesignNewz
NetworkingFiles SearchZA FlashNewz
SecurityConfig SearchNewz WebSiteNotes

Developer: IT Management: Security:
DevWebPro ITManagement SecurityProNews
DevNewz SysAdminNews SecurityConfig
TheDevWeb NetworkingFiles NetworkNewz

The iEntry Network consists of over 100 web publications reaching millions of Internet Professionals. Contact us to advertise.
eBUSINESS RESOURCES






 Advertise | Contact Us | Corporate | Newsletter | Sitemap | Submit an Article | News Feeds
 WebProNews is an iEntry, Inc. ® publication - $line) { echo $line ; } ?> All Rights Reserved
WebProWorld
Ten most recent posts.

WebProBlog
The official blog of WebProNews.

Go to WebProBlog

SearchBrains.com
NetworkingFiles
Featured Software


About WebProNews
WebProNews is the number one source for eBusiness News. Over 5 million eBusiness professionals read WebProNews and other iEntry business and tech publications.

WebProNews provides real-time coverage of internet business.

Free Email Newsletters:
WebProNews SearchNewz
WebProWorld DevWebPro
Marketing SecurityNews
Plus over 100 other newsletters!

Send me relevant info on products and services.




iEntry.com WebProWorld RSS Feed WebProWorld Contact WebProNews Print Version Email a friend Bookmark us SearchBrains.com SearchBrains RSS Feed