Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
administrative question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
rjw8703
Apprentice
Apprentice


Joined: 14 Aug 2004
Posts: 246
Location: Auburn, Al

PostPosted: Thu May 22, 2008 9:18 pm    Post subject: administrative question Reply with quote

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
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Thu May 22, 2008 10:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
Akkara
Bodhisattva
Bodhisattva


Joined: 28 Mar 2006
Posts: 6702
Location: &akkara

PostPosted: Thu May 22, 2008 10:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum