Jump to content

How to redistribute space from /usr to /var?


superyupkent
 Share

Recommended Posts

Hi all,

 

I'm having a little space problem at my server. Since my mysql/php databases started to work, I have a forum running and more ppl visiting my site. The problem is that when I configured my site nearly 1 year ago I installed the partition table as default. Now I am having a rather small /var and a big /home. While all my website space and other vital programs are situated on /var.

 

Is there a way I can repartition my hard drive?

 

Thanks,

 

Alex

Link to comment
Share on other sites

in reply to bvc,

 

even though this post helped me to understand more about the structure of the Linux partition table and it's uses. It is not exactly what I was looking for, perhaps I should give you some more details.

 

I am currently running Mandrake 9.0 together with apache, php, mysql, my hard drive is a 20GB maxtor with the following partitions:

 

1(boot)(2% of 20GB) 400MB 92MB Free

2(extd)(98% of 20GB) 19.6GB --MB Free

5(swap)(2% of 20GB) 400MB --MB Free

6(/usr)(20% of 20GB) 4GB 2.92GB Free

7(/var)(6% of 20GB) 1100MB 594MB Free

8(/home)(70% of 20GB) 14GB 12.75GB Free

 

As you can see I have a lot of space available @ /home, space that I don't use. However, since I am busy getting a heavy pic based website I could use that space @ /var.

So I am hoping there is a way for me to repartition /home to lets say 4GB en take the 10GB I have left to /var.

 

Hope this is more info

 

Alex

Link to comment
Share on other sites

Could you list the partition lables as they exist in linux?

 

Caution: changes in partitions could cause a loss of data!!! Even on a good day! I have successfully altered space, and I have lost everything, all following the same proceedures. Take heed and back-up.

Link to comment
Share on other sites

You can

cp -fR /var /home/var (verify all data is there)

mv -f /var /var.old

ln -s /home/var /var

 

verify that /var links to /home/var

ls /var

 

edit /etc/fstab's mount point to /var to /home/var and reboot.

...use the above at your own risk :wink:

When/if all is well...you can rm -f /var.old

 

As you know, MANY apps look for /var, and you can not change that, so a symlink somewhere is a necessity.

Link to comment
Share on other sites

edit /etc/fstab's mount point to /var to /home/var and reboot.

...use the above at your own risk :wink:

When/if all is well...you can rm -f /var.old

 

Forgive me to pop into this thread bvc :roll: but REBOOT??? My god!!! :shock: :P

 

Just do:

 

~# mount -a -o remount

 

or if you aren't confident, do it by steps:

 

~# umount /dev/<old var partition>

~# mount -a

 

In both ways the partition table will be updated ;)

Link to comment
Share on other sites

Here you go, please observe that I havent changed my fstab yet.

 

FSTAB:

 

/dev/hda1 / ext3 defaults 1 1

none /dev/pts devpts mode=0620 0 0

/dev/hda8 /home ext3 defaults 1 2

/dev/hdc /mnt/cdrom auto user,iocharset=iso8859-1,codepage=850,noauto,ro,exec 0 0

/dev/fd0 /mnt/floppy auto user,iocharset=iso8859-1,sync,codepage=850,noauto,exec 0 0

none /proc proc defaults 0 0

/dev/hdb1 /maxtor ext3 user 0 2

/dev/hda6 /usr ext3 defaults 1 2

/dev/hda7 /var ext3 defaults 1 2

/dev/hdA5 Swap swap defaults 0 0

/proc /proc proc defaults

 

DF -h:

 

Filesystem Size Used Avail Use% Mounted on

/dev/hda1 236M 119M 105M 54% /

/dev/hda8 14G 1.2G 13G 9% /home

/dev/hdb1 19G 33M 18G 1% /maxtor

/dev/hda6 3.9G 871M 2.8G 24% /usr

/dev/hda7 1.1G 433M 579M 43% /var

 

Since all my important websites are under var/www/html/www, var/www/html/forum, var/www/html/gallery, I thought it might be better

to just copy /var/www to /home/www. Hope you can give me some info in that in relation to the fstab. Also there seems to be a problem with

apache, since the program only permits access under /var/www/......

 

Hope this does it

 

Alex

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...