LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can I make /var a symbolic link (https://www.linuxquestions.org/questions/linux-newbie-8/can-i-make-var-a-symbolic-link-4175482088/)

hahacc 10-25-2013 02:36 AM

can I make /var a symbolic link
 
Hi guys,
Currently my /var is on its own partition. But as the free space of /var is now only several Mb, so I want to do this:

Code:

cd /
cp -a /var /Backup
mv /var /var.bak
ln -s /Backup/var var

Is this ok to do this? Thanks in advance.

zhjim 10-25-2013 02:44 AM

Should be good to go. Just dont do this on a running system that has var mounted.. Also this might work it can go wrong. Boot into a lifesystem to do this. And as you should boot a lifesystem you can also take a look if you can resize the partition of /var. And then dont need to copy stuff around.

Nother thing that comes to my mind is that there might be programs that dont like to be run through a symlink. But those are few. But to be extra sure you could rebind the part of the filesystem where the new var is and mount it under /var. Check out the man page of mount.

JJJCR 10-25-2013 02:49 AM

check out this thread below, it might give you an idea

http://www.linuxquestions.org/questi...ve-var-199391/

if you move var to another drive or partition, i guess it should work but i'm not sure.

Quote:

better try it on a virtual machine, delete the /var directory on the virtual hard drive.

Plug in a FAT or NTFS thumb drive, create a /var directory and check how it goes.

Edit fstab to make sure it knows where is /var located.
try it on a virtual machine before rolling out to the production

hahacc 10-25-2013 03:01 AM

Quote:

Originally Posted by zhjim (Post 5051970)
Should be good to go. Just dont do this on a running system that has var mounted.. Also this might work it can go wrong. Boot into a lifesystem to do this. And as you should boot a lifesystem you can also take a look if you can resize the partition of /var. And then dont need to copy stuff around.

Nother thing that comes to my mind is that there might be programs that dont like to be run through a symlink. But those are few. But to be extra sure you could rebind the part of the filesystem where the new var is and mount it under /var. Check out the man page of mount.

Thanks a lot! I moved /var to another partition and it worked.

---------- Post added 10-25-13 at 04:01 PM ----------

Quote:

Originally Posted by JJJCR (Post 5051971)
check out this thread below, it might give you an idea

http://www.linuxquestions.org/questi...ve-var-199391/

if you move var to another drive or partition, i guess it should work but i'm not sure.



try it on a virtual machine before rolling out to the production

Thanks, I tried on one test box and it worked.

zhjim 10-25-2013 03:02 AM

Another happy fellow :)

SAbhi 10-25-2013 03:55 AM

Should be good untill you don't know /var is the directory where multiple most required files reside including default location for DNS zone files, FTP's default and many more...

In your case it should have no severe effect because of you managed to make a symlink back to the same place but yes some programs would not like the way it would be!!! (depends upon when the check for /var directory performs it should returns true)

Quote:

But as the free space of /var is now only several Mb, so I want to do this
the above would be a temporary fix in that condition, i would recommend what @zhjim has suggested to resize /var.

hahacc 10-25-2013 04:21 AM

Quote:

Originally Posted by SAbhi (Post 5052015)
Should be good untill you don't know /var is the directory where multiple most required files reside including default location for DNS zone files, FTP's default and many more...

In your case it should have no severe effect because of you managed to make a symlink back to the same place but yes some programs would not like the way it would be!!! (depends upon when the check for /var directory performs it should returns true)



the above would be a temporary fix in that condition, i would recommend what @zhjim has suggested to resize /var.

Thanks pal for the remind. I would do the resizing work when ready.


All times are GMT -5. The time now is 04:45 AM.