Extending /var to accommodate more websites

Support for webhosts that use CentOS
Post Reply
mashamit
Posts: 9
Joined: 2011/02/20 22:02:42

Extending /var to accommodate more websites

Post by mashamit » 2012/09/12 13:33:29

Good afternoon everyone.

I have a CentOS 5 dedicated server hosted with 1and1. My current /var directory is 78% full therefore i need to extend it.

My server has approximately 80Gb of free space.

From a little look around it seems that the current partition cannot be extended (XDA?).

I could do with a little help with creating a new partition, copying current sites across, then redirecting everything to point at the new area.

Any help or advice on the best way to do this would be greatly appreciated.

Nick

areamike
Posts: 14
Joined: 2009/03/16 02:50:51
Contact:

Extending /var to accommodate more websites

Post by areamike » 2012/09/16 00:05:51

You should be able to use FDISK to create the additional partition, then copying /var/www to the new partition and changing the Document Root for your website in httpd.conf file is pretty much it.

mashamit
Posts: 9
Joined: 2011/02/20 22:02:42

Re: Extending /var to accommodate more websites

Post by mashamit » 2012/10/08 20:49:40

Thanks for the swift reply... Ive been busy so only just got back to this.

If I move the entire var/www folder to another partition are there any other issues I should look out for....

I have plesk 10.4 as my gui.

Is there anything for that or other processes I need to consider?

User avatar
TrevorH
Forum Moderator
Posts: 26936
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Extending /var to accommodate more websites

Post by TrevorH » 2012/10/08 21:17:26

How about giving us [url=https://www.centos.org/modules/newbb/viewtopic.php?topic_id=28723&forum=54]some information[/url] from getinfo.sh to go on so that we can help you better?

mashamit
Posts: 9
Joined: 2011/02/20 22:02:42

Re: Extending /var to accommodate more websites

Post by mashamit » 2012/10/08 22:01:36

Sorry I completely forgot about getinfo.... here you go

Information for general problems.
[code]
== BEGIN uname -rmi ==
2.6.18-194.26.1.el5xen x86_64 x86_64
== END uname -rmi ==

== BEGIN rpm -qa \*-release\* ==
centos-release-5-5.el5.centos
centos-release-notes-5.5-0
elrepo-release-5-3.el5.elrepo
== END rpm -qa \*-release\* ==

== BEGIN cat /etc/redhat-release ==
CentOS release 5.5 (Final)
== END cat /etc/redhat-release ==

== BEGIN getenforce ==
Disabled
== END getenforce ==

== BEGIN free -m ==
total used free shared buffers cached
Mem: 2048 1748 299 0 64 566
-/+ buffers/cache: 1117 930
Swap: 1913 8 1905
== END free -m ==

== BEGIN rpm -qa yum\* rpm-\* python | sort ==
python-2.4.3-27.el5
rpm-libs-4.4.2.3-20.el5_5.1
rpm-python-4.4.2.3-20.el5_5.1
yum-3.2.22-26.el5.centos
yum-fastestmirror-1.1.16-14.el5.centos.1
yum-metadata-parser-1.1.2-3.el5.centos
== END rpm -qa yum\* rpm-\* python | sort ==

== BEGIN ls /etc/yum.repos.d ==
CentOS-Base.repo
CentOS-Base.repo.rpmnew
CentOS-Media.repo
Citrix.repo
elrepo.repo
== END ls /etc/yum.repos.d ==

== BEGIN cat /etc/yum.conf ==
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

# Default.
# installonly_limit = 3

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
== END cat /etc/yum.conf ==

== BEGIN yum repolist all ==
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* elrepo: mirror.solvention.de
repo id repo name status
addons CentOS-5 - Addons enabled: 0
base CentOS-5 - Base enabled: 3,591
c5-media CentOS-5 - Media disabled
centosplus CentOS-5 - Plus disabled
citrix XenServer 5.5.0 updates for centos5x enabled: 33
contrib CentOS-5 - Contrib disabled
elrepo ELRepo.org Community Enterprise Linux Repository - enabled: 358
elrepo-extras ELRepo.org Community Enterprise Linux Repository - disabled
elrepo-kernel ELRepo.org Community Enterprise Linux Kernel Repos disabled
elrepo-testing ELRepo.org Community Enterprise Linux Testing Repo disabled
extras CentOS-5 - Extras enabled: 274
updates CentOS-5 - Updates enabled: 1,080
repolist: 5,336
== END yum repolist all ==

== BEGIN egrep 'include|exclude' /etc/yum.repos.d/*.repo ==
== END egrep 'include|exclude' /etc/yum.repos.d/*.repo ==

== BEGIN sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n ==
== END sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n ==

== BEGIN cat /etc/fstab ==
/dev/xvda1 / ext3 defaults 1 1
/dev/xvda2 none swap sw
/dev/vg00/usr /usr xfs defaults 0 2
/dev/vg00/var /var xfs defaults,usrquota 0 2
/dev/vg00/home /home xfs defaults,usrquota 0 2
devpts /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0
== END cat /etc/fstab ==

== BEGIN df -h ==
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 3.7G 843M 2.9G 23% /
/dev/mapper/vg00-usr 4.0G 1.5G 2.6G 36% /usr
/dev/mapper/vg00-var 4.0G 3.2G 835M 80% /var
/dev/mapper/vg00-home
4.0G 4.2M 4.0G 1% /home
none 1.0G 8.4M 1016M 1% /tmp
== END df -h ==

== BEGIN fdisk -l ==

Disk /dev/xvda: 100.0 GB, 100000595968 bytes
255 heads, 63 sectors/track, 12157 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/xvda1 1 487 3911796 83 Linux
/dev/xvda2 488 731 1959930 82 Linux swap / Solaris
/dev/xvda3 732 12157 91779345 8e Linux LVM
== END fdisk -l ==

== BEGIN parted -l ==


Error: Unable to open /dev/md0 - unrecognised disk label.


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 100GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 4006MB 4006MB primary ext3
2 4006MB 6013MB 2007MB primary linux-swap
3 6013MB 100GB 94.0GB primary lvm


== END parted -l ==

== BEGIN blkid ==
/dev/xvda2: UUID="9ea2a916-fecc-474e-8330-4590ab0fd49b" TYPE="swap"
/dev/mapper/vg00-home: LABEL="home" UUID="45781df8-c4be-4b83-8bed-f8e13b681f6b" TYPE="xfs"
/dev/mapper/vg00-usr: LABEL="usr" UUID="778bf9fd-d5d2-4058-9cea-97225a29d2e4" TYPE="xfs"
/dev/mapper/vg00-var: LABEL="var" UUID="1b7935d1-7a5b-469c-8395-49ceecdf3c03" TYPE="xfs"
/dev/xvda1: LABEL="root" UUID="de7da98d-d72a-4edb-be8f-b7901b42fe54" TYPE="ext3"
== END blkid ==

== BEGIN cat /proc/mdstat ==
Personalities :
unused devices: <none>
== END cat /proc/mdstat ==

== BEGIN pvs ==
PV VG Fmt Attr PSize PFree
/dev/xvda3 vg00 lvm2 a- 87.53G 75.53G
== END pvs ==

== BEGIN vgs ==
VG #PV #LV #SN Attr VSize VFree
vg00 1 3 0 wz--n- 87.53G 75.53G
== END vgs ==

== BEGIN lvs ==
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
home vg00 -wi-ao 4.00G
usr vg00 -wi-ao 4.00G
var vg00 -wi-ao 4.00G
== END lvs ==

== BEGIN rpm -qa kernel\* | sort ==
kernel-headers-2.6.18-194.26.1.el5
kernel-xen-2.6.18-194.26.1.el5
== END rpm -qa kernel\* | sort ==

== BEGIN lspci -nn ==
== END lspci -nn ==

== BEGIN lsusb ==
/usr/local/bin/getinfo.sh: line 89: lsusb: command not found
== END lsusb ==

== BEGIN rpm -qa kmod\* kmdl\* ==
kmod-xfs-xen-0.4-2
== END rpm -qa kmod\* kmdl\* ==

== BEGIN ifconfig -a ==


== END ifconfig -a ==

== BEGIN brctl show ==
/usr/local/bin/getinfo.sh: line 89: brctl: command not found
== END brctl show ==

== BEGIN route -n ==

== END route -n ==

== BEGIN cat /etc/resolv.conf ==
; generated by /sbin/dhclient-script
search ************************
nameserver **********************
nameserver ***********************
== END cat /etc/resolv.conf ==

== BEGIN grep net /etc/nsswitch.conf ==
#networks: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
netmasks: files
networks: files
netgroup: nisplus
== END grep net /etc/nsswitch.conf ==

== BEGIN chkconfig --list | grep -Ei 'network|wpa' ==
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
== END chkconfig --list | grep -Ei 'network|wpa' ==

[/code]

User avatar
TrevorH
Forum Moderator
Posts: 26936
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Extending /var to accommodate more websites

Post by TrevorH » 2012/10/08 23:43:00

Excellent, then it's easy. Your /var is on an LVM logical volume which you can resize at any time since you have 75GB free in the LVM volume group in which it resides.

[code]
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-var 4.0G 3.2G 835M 80% /var

VG #PV #LV #SN Attr VSize VFree
vg00 1 3 0 wz--n- 87.53G 75.53G
[/code]

So you need to run lvextend to add more space to the logical volume and then resize the filesystem on it which is more complicated than usual because I just spotted it is using xfs not ext3

[code]
lvextend -L+4G /dev/mapper/vg00-var
xfs_growfs /var
[/code]

Adjust the +4G to suit - my example adds 4GB to the existing size.

You also have more serious problems that you need to deal with: your system hasn't been updated for about 3 years and the kernel you are running has lots (at least 35, maybe 100) security vulnerabilities that are unpatched. If that's unpatched then I suspect the rest of the system is too and there will be numerous security vulnerabilities in other things too - probably in httpd for example. You need to schedule a complete `yum update` of your system sooner rather than later. A good read of the release notes for the newer releases before you start would be a good plan.

Post Reply

Return to “CentOS 5 - Webhosting Support”