2

I did $ df -h and it threw this:

Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              9.7G  1.7G  7.6G  18% /
/dev/md2              683G  211M  649G   1% /home
tmpfs                 4.0K     0  4.0K   0% /dev/shm

The problem is that my websites are located in /var/www, which I guess belongs to /, and they won't be able to use the disk space for things like images, that need to be placed inside the webroot, eg: /var/www/my_site/public_html/

What can I do about it? Should I move disk space from /home to / ? How? Or move the sites to /home ? Any thoughts?

Im using centos 5.5 and apache 2

2
  • If you don't want to do things the hacky way by linking or bind-mounts. Then reinstall the system and either use one big partition, or if really think you want multiple partitions then setup LVM, leaving lots of free space in your VG to be allocated as needed.
    – Zoredache
    Feb 22, 2011 at 21:24
  • I can't configure much on reinstall, it's a dedicated server that I manage remotely. I can only pick the distro and the architecture, through an automated system. Feb 22, 2011 at 21:33

3 Answers 3

2

Easier way will be to move the data to the larger partition, and symlink back into place.

 $ mv /var/www /home/
 $ ln -s /home/www /var/www
0
3

You can remount /home/www in /var/www use bind mounts.

Stop apache:

# service apache2 stop

Add in fstab line:

/var/www /home/www bind defaults,bind 0 0

Copy directory:

# cp -pR /var/www/ /home/www

Mount all:

# mount -a

Start apache:

# service apache2 start
5
  • What does it do? Feb 22, 2011 at 21:21
  • remount /home/www in /var/www
    – ooshro
    Feb 22, 2011 at 21:24
  • I don't get the copy part. Won't I have duplicated files? Should I keep creating sites in /var/www as usual, after doing this? Or in /home/www? Feb 22, 2011 at 21:27
  • @HappyDeveloper You can move file "mv /var/www /home/"(don't create copy).
    – ooshro
    Feb 22, 2011 at 21:39
  • To be honest I find bind mounts end up confusing things in the long run. They can also result in duplicate data when using a number of backup systems. Hence my suggestion of a simple move and symlink.
    – Coops
    Feb 23, 2011 at 7:36
1

It looks like /dev/md2 is quite large, and perhaps should be carved-up using LVM? From the looks of things you have Metadevices setup, which I am guessing is basically your software RAID. you could dedicate md2 to LVM, and split it up into any number of Logical Volumes (LVs). The only difficulty is your /home which you would have to move, temporarily to get /dev/md2 established under LVM. I find that with LVM management of partitions and filesystems becomes a snap. It is always better to use LVM from the get-go, but there is no reason why you could not just migrate to it, partially or completely.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .