3

I have a vServer and I can't upload/copy files.

It says "no space left on device" but I have like 130 GB on my hdd.

This is what it shows on: df -h /

df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/volume-root
                       39G   37G     0 100% /

This is what it shows on: df -i

df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/volume-root
                     2575440  293897 2281543   12% /
tmpfs                1024770       5 1024765    1% /lib/init/rw
udev                 1023447     517 1022930    1% /dev
tmpfs                1024770       1 1024769    1% /dev/shm
/dev/vda1              65536     222   65314    1% /boot
overflow             1024770       2 1024768    1% /tmp

It seems like the partition is nearly full (37gb out of 39gb) but I have 130 GB hdd, how can I fix this?

Disk /dev/vda: 167.5 GB, 167503724544 bytes
16 heads, 63 sectors/track, 324559 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e7311

Device Boot Start End Blocks Id System
/dev/vda1 *    3    523    262144 83 Linux
    Partition 1 does not end on cylinder boundary.
/dev/vda2    523  83221  41679872 8e Linux LVM
    Partition 2 does not end on cylinder boundary.
Hauke Laging
  • 5,157
  • 2
  • 23
  • 40
floube
  • 31
  • 1
  • 2

3 Answers3

3

You probably have a LVM volume group (VG) of about 130 GiB size (with the very creative name "volume") in which just one logical volume (LV) has been created. Have a look at it:

vgdisplay -v

Not throwing all capacity in /dev/root was a goot idea IMHO. You can either extend (lvresize, lvextend) the existing LV (and after that the file system in it) or create new ones (preferably). Use lvcreate or (better) your distro's tool for that. And have a look at your disk partitioning:

fdisk -l /dev/vda
Hauke Laging
  • 5,157
  • 2
  • 23
  • 40
  • lvextend -L+10G /dev/volume/root Can I use this to extend the current partion by 10gb ? – floube May 03 '13 at 20:28
  • fdisk -l /dev/vda On this it says the hdd is 167.5gb – floube May 03 '13 at 20:28
  • @floube that should probably work, depending on configuration of your LVM volume. – rvs May 03 '13 at 20:32
  • @floube Yes but you have to extend the file system afterwards which is not possible with every file system with the volume being mounted read-write. You should **really** consider creating an new LV instead (and copy data there). – Hauke Laging May 03 '13 at 20:33
  • I have to create a new PV (current VG has Free PE / Size: 0 / 0) but it says: pvcreate /dev/vda2 Can't initialize physical volume "/dev/vda2" of volume group "volume" without -ff And when I try it with an other name: pvcreate /dev/vda3 Device /dev/vda3 not found (or ignored by filtering). What should I do? – floube May 03 '13 at 21:04
  • @floube If you continue using programs like `pvcreate` without the slightest idea what you are doing then you are going to crash your whole system. Consider yourself warned. You haven't posted the output of `fdisk -l /dev/vda`. I assume that there are two partitions only. You have to create a new partition in the free space (not necessarily consuming all the free space). Use `cfdisk` if available or your distro's tool. This can be a primary or a logical partition, that doesn't matter. Then you reboot, make it a PV (by `pvcreate`) and add it with `vgextend`. – Hauke Laging May 03 '13 at 21:10
  • `Disk /dev/vda: 167.5 GB, 167503724544 bytes 16 heads, 63 sectors/track, 324559 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000e7311 Device Boot Start End Blocks Id System /dev/vda1 * 3 523 262144 83 Linux Partition 1 does not end on cylinder boundary. /dev/vda2 523 83221 41679872 8e Linux LVM Partition 2 does not end on cylinder boundary.` Thats the output, only two partions – floube May 03 '13 at 21:16
1

df -i can't prove anything here one inode of the 1GB file will make df -i with much less %. you need to see if you have free extents in your VG(Volume Group) You need to grow your LV(logical Volume) And then resize actual fs

Danila Ladner
  • 5,241
  • 21
  • 30
0

All the solutions here and elsewhere didn't work for me. I had a server VM that got 100% full due to a miscalculation of how much space I needed, and a script that didn't check for free space.

The problem was most of the solutions implicitly or explicitly needed some free space on the drive, for things like lock files or apt-get.

After expanding the VM, I finally found success booting SystemRescueCD on the VM. It seems that having the OS in RAM provided the wiggle room I needed to fix the system. I loosely followed these instructions (which are about shrinking an LVM volume group).

su - root

vgchange -a y

e2fsck -fy /dev/vg/root

resize2fs

resize2fs /dev/vg/root