Web Hosting Talk







View Full Version : Symbolic links


-Edward-
06-21-2001, 12:54 PM
well ....

If we move things like /tmp to the home directory how do you make a symbolic link too it? or symbolic links to anything u move?

ffeingol
06-21-2001, 01:01 PM
It's easy :D

ln -s source_file target

If you want the full syntax etc just do man ln. Both of these commands can be executed from telnet/ssh.

Frank

-Edward-
06-21-2001, 01:10 PM
the code looks easy enough but how do i know what to link to ???? ..... i just dont wanna mess my box up.

ffeingol
06-21-2001, 01:48 PM
Well I guess I would have to ask WHY you want to move /tmp? Linux relies on a /tmp directory being there and moving that directory will prob. crash the server.

Frank

huck
06-21-2001, 03:33 PM
Moving /tmp will not crash the server...
The easiest way is to copy /tmp to /home/tmp and then rm /tmp and make a symlink to /home/tmp. If you are using program that rely on files in /tmp, shut them down and then restart. Unless your sever is really busy, you can usuall get away with doing this on a live machine. Only a few things in /tmp are required for proper function, e.g. mysql.socks (which I no longer keep in /tmp anyway). Some shopping cart systems may use tmp but this is not wise either. Generally, you should be able to get rid of files in /tmp without critically damaging anything --- after all, that is why it is the /tmp directory.;)

-Edward-
06-21-2001, 03:58 PM
how would i make the symbolic link ?? .... i.e what would i type to make the link after the move the code ......

jaime
06-21-2001, 04:37 PM
1. cd /
2. su root
3. mv tmp /home/sites/home (or to another dir you want)
4. ln -s /home/sites/home/tmp tmp

thats' it.

Now you have the root tmp dir in /home/sites/home

and if you type:

dir -l

You will see that the original tmp dir is pointing to the other one:

tmp -> /home/sites/home/tmp

ffeingol
06-21-2001, 05:12 PM
I guess I'm totally missing the point here (but I am new to RAQ's). Why would you want to move /tmp???

Frank

jaime
06-21-2001, 05:18 PM
Originally posted by ffeingol
I guess I'm totally missing the point here (but I am new to RAQ's). Why would you want to move /tmp???

Frank

Did you check this thread?

http://webhostingtalk.com/showthread.php?&threadid=7615

See why sometimes It's necessary to move some files to free space... at least untill you know how to stop growing files ;)

-Edward-
06-21-2001, 05:38 PM
Well i moved my tmp folder doesnt make any difference on the size of my drive .... wonder what to move next .....

ffeingol
06-21-2001, 05:39 PM
Jaime,

Thanks. That's what I guessed it was. The / partition was filling up.

Frank

jaime
06-21-2001, 06:02 PM
Originally posted by Technics
Well i moved my tmp folder doesnt make any difference on the size of my drive .... wonder what to move next .....

Have you moved the reports dir ??

/usr/admserv/html/.cobalt/reports

Check its size. that was growing more than 20 megs a day in my raq. See my post above.

-Edward-
06-21-2001, 06:11 PM
have you had any problems since moving these files?

jaime
06-21-2001, 06:21 PM
No problems at all. I'ts safe.

Also moved my MYSQL databases out from / to /home.

Now those reports are still growing in my /home partition. More that 25 mb's per day. if i had not moved them, my server would have crashed ( / was at 96% full !!)

-Edward-
06-21-2001, 06:22 PM
Just making tripple sure .... who said its safe ?? :)