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? |
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). |
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 |
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. |
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 |
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". |
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 :) |
All times are GMT -5. The time now is 04:36 AM. |