Learn how to fix the “No Space Left on Device” error on Linux in a VM.
Are you getting the following error message? Then you came to the right video.
No space left on device.
Sometimes you will get the error message… No space left on device.
Whatever it is the steps are same. This will be a demo of How to Fix the “No Space Left on Device” Error on Linux on VMware.
Here are the command used in this video.
1) Switch to super user.
sudo su
2) Launch linux partition editor.
cfdisk
3) Create new device and assign it as Linux LVM.
In my demo, my device name was /dev/sda4. Yours might be difference depending on the existing number of devices in your system.
4) Reboot the Ubuntu VM (or else you might get Device /dev/sda4 not found)
shutdown now -r
5) Once the Ubuntu VM is up, login as super user again.
sudo su
6) Create physical volume for the new device.
If you forgot your device name, launch the Linux partition editor again using the cfdisk command.
pvcreate /dev/sda4
7) Find out the volume group name using
vgs
If you want to see the detail information about the volume group use the following command.
vgdisplay
In my demo video, my volume group name was ubuntu-vg. Yours might be different.
8) Extend volume group.
vgextend ubuntu-vg /dev/sda4
9) If you check the volume group, again you will see increment in your volume group size.
vgdisplay
10) Extend the size of a logical volume.
The command below is to increase using all the allocated space.
lvextend -l+100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv
The command below is to increase by only 2GB in the allocated space.
lvextend -L +2g /dev/ubuntu-vg/root
11) Increase the file system.
resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv
12) And finally, check the disk filesystem to make sure that the disk space has increased.
df -h
Reference
- Increase partition size on which Ubuntu is installed
- How to extend partition in Ubuntu Guest on Vmware
- How do I increase disk space in Ubuntu VM
- cfdisk
- lvextend(8) – Linux man page
- vgextend(8) – Linux man page
- pvcreate(8) – Linux man page
- vgdisplay(8) – Linux man page
- vgs(8) — Linux manual page
- resize2fs(8) – Linux man page
- Useful “df” Commands to Check Disk Space in Linux
- How to Fix the “No Space Left on Device” Error on Linux
- No space left on device