Saturday, December 1, 2018

disk space wrongly displayed after installing LVM disk




I installed ubuntu server using LVM partitioning on a 1 TB hard disk. However, after installation, i can only see 10 Gig space
here is the fidsk output



`
# fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00041507

Device Boot Start End Blocks Id System
/dev/sda1 * 1 10 71680 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 10 121602 976689152 8e Linux LVM

Disk /dev/dm-0: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table
You have new mail in /var/mail/root

and df -h output


df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-root
9.9G 6.6G 2.8G 71% /
devtmpfs 1.9G 232K 1.9G 1% /dev
tmpfs 1.9G 4.0K 1.9G 1% /dev/shm
/dev/sda1 68M 22M 43M 34% /boot
tmpfs 6.0G 0 6.0G 0% /var/spool/asterisk/monitor
You have new mail in /var/mail/root



`



any way to increase this space without reisntalling?



You apparently only allocated 10gb to your root fs. You can use pvs to see how much space lvm has allocated to volumes, and how much it has left, and lvextend to increase the size of a logical volume ( does not need to be unmounted ). After increasing the size of the logical volume, you will need to tell the fs to use the new space. Assuming you are using ext[234], you can do this with resize2fs, which also can expand without unmounting.



sudo lvextend -L 20g system/root
sudo resize2fs /dev/mapper/system-root



Note that expanding the volume to use ALL of the unallocated space may not be such a great idea, since you won't have any left to add new volumes later, should you choose to do so, or make use of lvm snapshots. You can reduce the size of the volume later to free up some space, but that requires the fs to be unmounted, thus you will need to boot the server from some other medium.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...