LVM2 and adding disksLinux
As part of my media server, one of the things that I need to be able to do is to add disks when I need them. I decided to run the server from an 80Gb drive that I had spare, but knew the first drive I would add would be a 400Gb SATA drive so I installed my debian system with LVM2 support.
The latest kernel (18.104.22.168) has good SATA support for my Maxtor card, so I upgraded through debian and wanted to increase my /assets LVM logical drive.
I had already created a volume group called volume1 and I had create a logical volume called assets which I mounted at /assets
Adding the drive was easy, just plug in the hardware and start the system up.
dmesg will show that it has seen the new harddrive after it has booted, just look for a device that is the same size as the one that you have added. If the device doesn’t show up it may mean that you have installed it incorrectly or that there is some problem supporting the device that you have installed.
fdisk the new drive. Being a SATA drive it is seen as a SCSI device, and as it is my first SCSI device on the system it will be at /dev/sda
Create as many partitions as needed, I created one primary partition.
See what has happened with all the partitions by issuing the following:
Extend the existing Volume group by:
vgextend volume1 /dev/sda1
Now take alook at the exist volume groups:
Unmount the logical group that you wish to expand:
Now checkout how much space that you have on your volume group so that you can determine how much you can add to your existing logical group.
It will show the Free PE / Size – this will be the amount that you can resize by.
Resize the logical group:
lvextend -L+372.6G /dev/volume1/assets
Check the filesystem is ok (I am using the ext3 file system, you will need other tools for other file systems):
e2fsck -f /dev/volume1/assets
Now resize the data in that logical group.
On my 400Gb drive this resizing took some time. Finally remount the drive and continue using it.
And check that you have all that space added.
comments powered by Disqus