View previous topic :: View next topic |
Author |
Message |
rjw8703 Apprentice
Joined: 14 Aug 2004 Posts: 246 Location: Auburn, Al
|
Posted: Thu May 22, 2008 9:18 pm Post subject: administrative question |
|
|
My /var directory has over grown its partition. What is the proper way to move the /var to a new partition. I've tried mv /var /dev/sda10 and cp /var /dev/sda10, but neither of the commands worked. |
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Thu May 22, 2008 10:07 pm Post subject: |
|
|
You're trying to copy a directory to a raw block device, what you need to do is format the new partition (sda10), mount it somewhere and then copy.
Also, when copying make sure you use the -a flag to preserve symlinks and permissions and such, ie `cp -a /var /mnt/newvar`. _________________ "You have to invite me in" |
|
Back to top |
|
|
Akkara Bodhisattva
Joined: 28 Mar 2006 Posts: 6702 Location: &akkara
|
Posted: Thu May 22, 2008 10:08 pm Post subject: |
|
|
Is this a completely new, previously unused partition you want to use?
If so, first you have to make a filesystem on your new partition if there isn't one already on it. Something like mkfs.ext3 /dev/sda10, or use your own command and options if you already have an idea how you want to set it up.
Then you have to copy your old /var onto your new one. To do that, first mount the partition somewhere: Code: | mkdir -p /mnt/var
mount /dev/sda10 /mnt/var |
Then copy /var onto it: Code: | cp -av /var/. /mnt/var |
(You change the '-av' above to just '-a' if you don't want to see a lot of what-its-copying scroll by.)
Then change your fstab to indicate where the new /var will come from. A line similar to this one should work: Code: | /dev/sda10 /var ext3 defaults 1 2 |
Then reboot. Your var should now be coming from the new partition.
There's some caveats: /var changes a lot - things like the system logger, time (ntpd if you run it) are often writing stuff there. The procedure above will lose the changes that happen between the copy command and the reboot. To be absolutely sure you get it all, do the copy from a live-CD.
Good luck! |
|
Back to top |
|
|
|