My system is Ubuntu 14.04 LTS
Enter the command df -h
, the display will be as follows:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root 19G 18G 0 100% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.9G 12K 3.9G 1% /dev
tmpfs 799M 2.0M 797M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 4.9M 3.9G 1% /run/shm
none 100M 0 100M 0% /run/user
/dev/vda1 236M 37M 188M 17% /boot
The total space is only more than 20 G, which is no longer enough.
And enter fdisk -l
, the display will be as follows:
Disk /dev/vda: 322.1 GB, 322122547200 bytes
16 heads, 63 sectors/track, 624152 cylinders, total 629145600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009d617
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 499711 248832 83 Linux
/dev/vda2 501758 41940991 20719617 5 Extended
/dev/vda5 503806 41940991 20718593 8e Linux LVM
Disk /dev/mapper/ubuntu--vg-root: 20.1 GB, 20124270592 bytes
255 heads, 63 sectors/track, 2446 cylinders, total 39305216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/ubuntu--vg-root doesn't contain a valid partition table
Disk /dev/mapper/ubuntu--vg-swap_1: 1069 MB, 1069547520 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2088960 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/ubuntu--vg-swap_1 doesn't contain a valid partition table
Could you please explain it and tell me how to expand the space to the 300G size displayed by fdisk?
Your machine has two hard drives, one is /dev/mapper/ubuntu--vg-root, and the size is 20.1 GB. This is your system disk, and the usage rate has now reached 100%.
The other disk is /dev/vda, which is 322.1 GB in size and is currently unmounted.
Ni’s /dev/vda is not mounted
Current situation: You have a 300G hard disk with two partitions, one is the main partition /dev/vda1, more than 200M, mounted to /boot, an extended partition /dev/vda2, which has a logical partition /dev /vda5, occupies 20G of space. LVM was created on /dev/vda5. LVM allocated 19G of it to /dev/mapper/ubuntu--vg-root and mounted it to the root directory, while the other 1G was allocated to / dev/mapper/ubuntu--vg-swap_1 swap partition.
Problem: Only 20G of the 300G space is used, and the other 280G is not used.
Solution: Use fdisk to create a new partition on the remaining space, then add the newly created partition to LVM, and finally expand the size of /dev/mapper/ubuntu--vg-root. I don’t know the specific command. Familiar, the general idea should be like this.