Notes on adding second and third drives to a volume group after original installation using the command line tools.
PART 1:
Review what you have:
$ sudo lsdblk
Fdisk to create new primary partitions of type 8e (LVM).
sudo fdisk /dev/sdb
(steps: n (new partition) --> p (primary) -> took defaults of start and end of whole drive)
sudo fdisk /dev/sdc
(same steps for second drive)
PART 2:
Create the LVM disks. To do this we have to create:
1. Physical Volumes in the new primary partitions from PART 1.
2. Volume Group (of same name) within the each drive's physical volumes.
3. Logical Disk that spans the volume group on the drives.
Extend the 2nd drive's physical volume to the 3rd drive:
sudo pvextend share /dev/sdb1 /dev/sdc1
(or if new do this instead: sudo pvcreate share /dev/sdb1 /dev/sdc1)
- share = name of volume group
Create the new volume group in each of the two drives that will contain the spanning logical drive.
sudo vgcreate share /dev/sdb1 /dev/sdc1
- share = name of volume group
Do a probe. This seems to tell the system the volume group exists.
sudo partprobe
(My system displays errors because there is no floppy in the floppy drive - ignore any dev fd0, sector 0 errors. That's unrelated.)
Display the volume groups:
sudo pvscan
PV /dev/sdb1 VG share lvm2 [ 4.20 GB / 4.20 GB free]
PV /dev/sdc1 VG share lvm2 [ 4.20 GB / 4.20 GB free]
PV /dev/sda1 VG workspace lvm2 [ 3.96 GB / 52 MB free]
Total: 3 [12.35 GB] / in use: 3 [12.35GB / in no VG: 0 [0 ]
Create the logical disk in the volume group:
sudo lvcreate -n smbshare -L 8.39G share
-n = name of logical volume
-L = size in M or G
share - name of the volume group that contains the new logical volume.
Verify the logical disk was created by rescanning the volume groups.
sudo pvscan
PV /dev/sdb1 VG share lvm2 [ 4.20 GB / 0 MB free]
PV /dev/sdc1 VG share lvm2 [ 4.20 GB / 0 MB free]
PV /dev/sda1 VG workspace lvm2 [ 3.96 GB / 52 MB free]
Total: 3 [12.35 GB] / in use: 3 [12.35GB / in no VG: 0 [0 ]
PART 3:
Format the new logical volume so we can use it.
Ext4:
sudo mkfs.ext4 /dev/share/smbshare
or:
sudo mke2fs - t ext4 -L SMBSHARE /dev/share/smbshare
Notes:
- The -j option was specific for ext3 - we have omitted it.
- The -t option can be dropped if ext4 is already the default filesystem type in /etc/mke2fs.conf.
- The -L option allows us to give it a label.
Test the new logical disk by mounting.
cd /
sudo mkdir local
cd local
sudo mkdir /smbshare
sudo mount /dev/share/smbshare /local/smbshare
Display the free space on the mounted partitions and verify the size of the new logical disk:
df
If this works, edit /etc/fstab and add the new logical disk so that it still is mounted after a restart.
Get the UUID of the new drive for fstab:
sudo vol_id -u /dev/share/smbshare
Update the fstab file and add the new line:
sudo vi /etc/fstab
(e.g. UUID=b8ab3b85-e4b5-4ea8-99d4-ddf12345b2e1 /local/smbshare ext3 relatime,errors=remount-ro 0 1)
Restart the box and verify the new logical disk mounts:
sudo reboot
_________________________________
Note:
If you are reusing an old volumn group, you say that it is "INACTIVE" when you do lvscan.
To enable it, you would type the following:
lvchange -a y '/dev/share/smbshare'
previous page
|