0

I have installed ubuntu server 16.04 as a webserver at work. I had initially allocated 100GB to it. For some reason, some of the space has been eaten up by tmpfs and I am not able to claim it back.

Here is what i get when I run df -h

Filesystem                           Size  Used Avail Use% Mounted on
udev                                  31G     0   31G   0% /dev
tmpfs                                6.2G  8.9M  6.2G   1% /run
/dev/mapper/filesystem--vg-root       36G   34G  238M 100% /
tmpfs                                 31G     0   31G   0% /dev/shm
tmpfs                                5.0M     0  5.0M   0% /run/lock
tmpfs                                 31G     0   31G   0% /sys/fs/cgroup
/dev/sda1                            472M   57M  391M  13% /boot
tmpfs                                6.2G     0  6.2G   0% /run/user/1000

It appears that my / folder is full. Which is not supposed to be the case. The server has already used up the 36GB only. Please help someone.

  • If you're new to Linux it's best to let the installer partition for you. – Alxs Apr 28 '17 at 7:23
  • True, will do that in future @Alxs. But now i need to resolve the mess that i have created. If you could assist, i would be very greatful. – TomGeneric Apr 28 '17 at 7:25
  • 1
    Can you please add result of command du -sh /* – Romeo Ninov Apr 28 '17 at 7:31
  • 2
    Can you provide the output of sudo fdisk -l? – Alxs Apr 28 '17 at 7:39
  • 1
    I beliver my problem is coming from the /dev/mapper/thitoacademics--vg-swap_1: 62.9 GiB. I dont know how i can reduce its size. – TomGeneric Apr 28 '17 at 7:44
3

As understand from the comments OP have very huge swap partition. Here is the procedure to shrink it to the reasonable size:

  1. Disable swap: swapoff /dev/mapper/thitoacademics--vg-swap_1
  2. Change the swap LV to 4GB: lvreduce -L 4G /dev/mapper/thitoacademics--vg-swap_1
  3. Recreate new swap (just in case): mkswap /dev/mapper/thitoacademics--vg-swap_1
  4. Add new swap: swapon /dev/mapper/thitoacademics--vg-swap_1

All those commands need to be executed as root

For moving the free diskspace to the other LV/filesystem you should follow those steps:

  1. Extend the other filesystem:

lvextend -L+4G /dev/mapper/filesystem--vg-root

  1. Extend the filesystem

resize2fs /dev/mapper/filesystem--vg-root

Again all those commands need to be executed as root

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.