If reinstall is an option for you, probably the easiest way would be to reinstall the system without using LVM.
If you can't reinstall, the the following commands may help you investigate what's going on.
LVM operates on three "layers" of objects. The bottom layer are the physical volumes (probably you have only one, as you have only one usable partition). Physical volumes are - in short - partitions or whole disks that will be used for LVM. The command sudo pvs
will list the physical volumes defined on your system. Here is a sample output:
PV VG Fmt Attr PSize PFree
/dev/sda1 vg_xymon lvm2 a-- 135.97g 0
/dev/sdb2 vg_xymon lvm2 a-- 136.17g 0
We can see there are two physical volumes (partitions), on two different disks - /dev/sda1
and /dev/sdb2
. Their sizes are shown and the "VG" column indicates that they are both assigned to a volume group called vg_xymon
.
Volume groups are an intermediate layer between physical and logical volumes, which allow eg. for a logical volume to span multiple physical volumes. There is usually only one volume group in the system. You can display information about volume groups with the command sudo vgs
. Again, sample of the output:
VG #PV #LV #SN Attr VSize VFree
vg_xymon 2 3 0 wz--n- 272.14g 0
We can see that the volume group spans two physical volumes (shown previously), so the volume group size is equal to sum of their sizes (In your case, both the physical volume size and the volume group size should be equal to the size of your partition - if not, then something is really, really wrong). We can also see that there are 3 logical volumes defined within this volume group.
Logical volumes are the top layer - these are places where your filesystems are actually located. Your /dev/mapper/ubuntu--vg-ubuntu--lv
device is a logical volume. The last component of the path is a combination of the volume grup name, dash, and a logical volume name. So your logical volume is called ubuntu--lv
and belongs to volume group ubuntu--vg
.
And one more command, sudo lvs
, displays information about logical volumes:
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lv_home vg_xymon -wi-ao--- 218.28g
lv_root vg_xymon -wi-ao--- 50.00g
lv_swap vg_xymon -wi-ao--- 3.86g
(so the first one in this example will be visible as device /dev/mapper/vg_xymon-lv_home
). Probably your problem lies here, ie. the logical volume is smaller than your volume group and the rest of the space in the volume group is unallocated.
In that case, you can extend it to fill the entire volume group with the command:
sudo lvextend -r /dev/mapper/ubuntu--vg-ubuntu--lv
However, because your root filesystem is mounted on that logical volume, extending it from the installed system may be impossible and you may need to boot from the install media to do it. In that case maybe it will be better to create an additional logical volume that uses the rest of the space on the volume group and mount it onto your media directory, while keeping your root filesystem unchanged:
sudo lvcreate -l 100%FREE -n media ubuntu--vg
This will create a new logical volume media
in existing volume group ubuntu--vg
(so the device path will be /dev/mapper/ubuntu--vg-media
), using 100% free space in the volume group.
Then you have to format the newly created logical volume:
sudo mkfs /dev/mapper/ubuntu--vg-media
and finally mount it onto your /media
directory (or whatever it is called, you must create the empty directory first):
sudo mount /dev/mapper/ubuntu--vg-media /media
If you want this mount to be persistent ie. that you don't need to repeat the above sudo mount
command everytime you boot your system, you need to edit your /etc/fstab
file (sudo gedit /etc/fstab
) and add the following line to it:
/dev/mapper/ubuntu--vg-media /home ext4 defaults 0 2
(assuming your filesystem is ext4
, use the same value that is used in the line specifying your /
filesystem).