/var is using 91.4% of 3.99GB in new Ubuntu dedicated server from 1and1
Solution 1:
Turns out my system supports extending a logical volume online. Here is how to solve it:
# df -h
Partitions and logical volumes will be listed:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 3.7G 736M 3.0G 20% /
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 1.6G 260K 1.6G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 0 3.9G 0% /run/shm
/dev/mapper/vg00-usr 4.0G 1007M 2.9G 26% /usr
/dev/mapper/vg00-var 4.0G 3.7G 145M 97% /var
/dev/mapper/vg00-home 4.0G 251M 3.6G 7% /home
Choose the partition you wish to expand and run it through lvextend
# lvextend -L +46G /dev/mapper/vg00-var
Where +46G
is the number is GB you want to add, in my case 46+4 = 50.
After that you need to increase the file system to match that of the logical volume using:
# resize2fs /dev/mapper/vg00-var
And you will have a larger partition:
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/mapper/vg00-var is mounted on /var; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
Performing an on-line resize of /dev/mapper/vg00-var to 13107200 (4k) blocks.
The filesystem on /dev/mapper/vg00-var is now 13107200 blocks long.
The new df -h
output:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 3.7G 737M 3.0G 20% /
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 1.6G 260K 1.6G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 0 3.9G 0% /run/shm
/dev/mapper/vg00-usr 4.0G 1008M 2.9G 26% /usr
/dev/mapper/vg00-var 49G 3.7G 43G 8% /var
/dev/mapper/vg00-home 4.0G 251M 3.6G 7% /home
Solution 2:
Based on your output from fdisk -l
it seems that your /dev/sda
disk is actually a 1TB drive. The volume that holds your /var
directory, however, is only a 4GB volume, which is way too small to be usable in the long-run.
It is possible to extend a logical volume, but not while it is mounted. This is going to present some difficulty, especially if the server is colocated and you don't have physical access to it. The hosting company may be able to provide you with an IPKVM device, which will allow you to boot up a recovery disk remotely, and adjust the volume size. However, as you've already said that you're not too fluent on the console or with Linux in general, I highly suggest avoiding this route. Rather, I suggest one of the following:
- Contact the hosting company and find out whether one of the tech support guys can adjust the size of the volume on which the
/var
directory is mounted to something more reasonable, at least to around 50GB since you do have a 1TB drive available. The server will be taken offline during this change, since the/var
directory will have to be unmounted during the process. - Alternatively, ask for a reinstall of the entire operating system, and tell them to set the volume size to at least 50GB. This may work out cheaper than having them perform this adjustment on the live system since it's less technical. Given that you don't have much technical knowledge with Linux, an even better solution would be to tell them to reinstall the operating system without adding any special mount points for
/usr
/var
and/home
and instead rather just mount everything on the root volume. The only benefit of creating special mount points on separate volumes (which is how you're set up at the moment) is that if one volume fills up, it doesn't bring down your entire system. However, setting a volume size to 4GB as they've done in your case seems very silly, especially given the size of your hard disk.