This steps are based on this answer https://askubuntu.com/a/7841/153797.
We want to join more SSDs to make appear as one single volume, at were we keep the home folder of the server.
- Samsung (sda 931.5G)
- ScanDisk (sdc 447.1G)
sudo fdisk /dev/sda
Create a dos partition table: o
List all partitions: p
Delete all partitions: d
(you can keep any partition that will not be used in LVM)
Create new: n
[p, 1, blank, blank]
Set the filesystem: t
[8e]
Write the changes: w
sudo pvcreate /dev/sda1
all this steps can be repeated with another sdx
disk
creating a volume group with name "home"
sudo vgcreate home /dev/sda1
sudo lvcreate -l100%FREE -nvolume home
sudo mke2fs -t ext4 /dev/home/volume
Now if the drive name is /dev/sdc1 then do
sudo vgextend home /dev/sdc1
to add it to the volume.
Now we need to unmount the volume, if mounted.
sudo umount /dev/home/volume
Now you can see the stats on your volume now by running sudo vgdisplay
. The important part is Free PE / Size
. You need to know how much space you can add to the volume for the next step.
So if you had 150 Gb of space you would do sudo lvextend -L+150G /dev/home/volume
.
Now run sudo e2fsck -f /dev/home/volume
to check the filesystem.
Now run sudo resize2fs /dev/home/volume
to resize everything.
You can run the stats again and verify that Free PE / Size
has dropped to what you expect.
Remount the volume by doing sudo mount /dev/home/volume /mnt/home
Rinse and repeat for any other drives.