How to expand a partion in Unix

paopao

Member
Jul 22, 2000
191
0
0
Ween I install Linux I usually patitioned the HD like this:
/boot 25MB
/tmp 128MB
/SWAP 1X or 2X Phisical RAM
/usr 1GB
/ Rest of it.

I was told that if I partitioned this way, it will be easier to expand a partion later.

So here is my question:
The 1st HD I initially installed is getting full mainly due to /var (lots of web logs files)
I just installed a new 9.1 GB HD, and I would like to mount /var to this new HD.
How do I do it? Can anyone gives me a quick step by step?
Any suggestions on a flexible partion method?
Thanks!
 

SlimHarpo

Member
Oct 1, 2000
72
0
0
Well, if your new HD is hdb, with the partition you want to use at hdb1, then you could just do:

mkdir /newvar
mount /dev/hdb1 /newvar
cd /var
cp -a * /newvar
mv /var /oldvar
mv /newvar /var

Now add a line to your /etc/fstab so that /dev/hdb1 gets mounted automatically at /var (just use the other lines in there for reference) and then reboot, if you want. Once everything seems to be working ok, you can rm -rf /oldvar.