LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-31-2006, 04:40 PM   #1
Maverick1182
Member
 
Registered: Aug 2004
Location: London
Distribution: Gentoo
Posts: 277

Rep: Reputation: 30
Moving /var


I've run out of space on my gentoo installed partition which specifically holds /var

I intend to move the folder into the maind drive under /

I have already created a folder in the main drive called /my/var into which ive copied all the files.

I was wondering if there is a was of mount /my/var as /var (as far as the computer can tell) so that it may give me time to delete the old partition on which /var originally resides so that i can create a new large partition onto which i will copy the /var back.

I have tried to use mount --bind /var /myvar

but doing an ls /var still points to the contents of the old folder.

Any ideas?
 
Old 07-31-2006, 04:47 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Does it work if you create a symbolic link in / called var and point it to /my/var?

Try renaming /var ro /var.sav and create a link. If this doesn't work, you can just rename it back (even if you need a rescue disk).
 
Old 07-31-2006, 04:48 PM   #3
jeelliso
Member
 
Registered: Oct 2005
Location: Knoxville, Tn (USA)
Distribution: OpenSUSE, Ubuntu
Posts: 250

Rep: Reputation: 30
You can create a softlink from /var to /my/var, so that anything trying to access /var will actually to to /my/var.

ln -s /var /my/var

[EDIT]Oops, beat me to it[EDIT]

~Justin
 
Old 07-31-2006, 04:57 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
Whenever I do fiddly stuff like that, I like to boot up a LiveCD. I'm not enough of a Linux expert to know when messing with /var or /tmp will break the OS out from under me. With a LiveCD, I'd just be messing with some non-OS files.

My latest experimentation has been with diskless net-booting. It's almost creepy, being able to shut down the client computer entirely and still have access to its OS files on the server.
 
Old 07-31-2006, 05:13 PM   #5
Maverick1182
Member
 
Registered: Aug 2004
Location: London
Distribution: Gentoo
Posts: 277

Original Poster
Rep: Reputation: 30
hmmm, this hasnt worked, its still displaying the contents of the old /var when i type ls /var

i can tell this as i have created a new file in /my/var called temp.txt which isnt showing up
 
Old 07-31-2006, 05:28 PM   #6
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
Remember that you need to unmount /var before moving it around. Really, trying to do this stuff on a "live" system seems a bit foolhardy to me. I'd personally boot up a LiveCD like Knoppix to do this stuff.

But assuming you can mess with /var in a live system without breaking it, here are the steps you'll need to do:

unmount /var
mv /var /varBACKUP
ln -s /my/var /var

Note that the existing /var folder should be empty (you use an empty directory to mark a mountpoint for another partition). Using "mv" to rename it rather than deleting it outright is merely an overly paranoid precaution.

The "ln -s" statement creates the symlink the correct way. The statement shown above has it the wrong way around. The example I give creates a new link in the position "/var", pointed at "/my/var".
 
Old 07-31-2006, 07:37 PM   #7
Maverick1182
Member
 
Registered: Aug 2004
Location: London
Distribution: Gentoo
Posts: 277

Original Poster
Rep: Reputation: 30
Thanks gang, yes, a live CD is a much better idea. I did as you described and worked perfectly... hope 5 gb is enough for /var! lol if not then i'll resize (another new and heartstopping experience)

thanks again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't install packages after moving /var zag_zag Debian 4 11-26-2004 06:21 AM
Moving /var/adm and /var/lib - why does it hurt? J_Szucs Linux - General 1 09-15-2004 07:46 PM
Moving /var to new partition burnpile Slackware 2 12-10-2003 01:33 PM
moving /var to a new hdd freelinuxcpp Linux - Software 4 11-02-2003 03:52 AM
FTP server not working after moving /var jeffpoulsen Linux - Software 2 10-22-2002 05:34 PM


All times are GMT -5. The time now is 04:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration