Create A Phy-Vol-lvm
Create A Phy-Vol-lvm
on /dev/sdc and /dev/sdd.
2. fdisk /dev/sdc
The interactive program opens with a short statement on its use, information
about the device selected, and a command prompt.
a. Enter n to add a new primary partition.
b. Enter p, followed by the number 1 for the first primary partition.
c. Press Enter to accept the default (2048) as the start of the first sector.
d. Enter +1G to set the last sector using the size notation.
Note: fdisk returns a message telling you that the new partition is of
the type ‘Linux’ with a size of 1 GiB.
e. Enter n, to create a second primary partition.
f. Enter p, followed by the number 2 for the second primary partition.
g. Press Enter to accept the default as the start of the second sector.
h. Enter +1G to set the last sector using the size notation.
Note: fdisk returns a message telling you of the new partition of the
type ‘Linux’ with a size of 1 GiB.
i. Enter t to change the partition type on partition 2.
j. Press Enter to accept the default of partition 2.
k. Enter 8e as the Hex code for the Linux LVM partition type.
Note: Pressing the letter L displays the Hex codes for the partition
types.
4. fdisk /dev/sdd
a. Enter n to add a new primary partition.
b. Enter p, followed by the number 1 for the first primary partition.
c. Press Enter to accept the default (2048) as the start of the first sector.
d. Enter +1G to set the last sector using the size notation.
Note: fdisk returns a message telling you that the new partition is of
the type ‘Linux filesystem’ with a size of 1 GiB.
1. Use the fdisk command and pipe the output to grep to list the ‘Linux LVM’
partitions. The command uses the lowercase letter l and not the numeral one.
2. fdisk -l | grep 8e
Note: Review the command output and notice the actions taken to set up the
physical volume.
f. pvscan
d. vgdisplay myvolg
Note: The volume group contains one physical volume and zero logical
volumes.
e. Use the vgs command to report information in a more condensed
form.
f. vgs myvolg
h. vgscan
j. pvs /dev/sdc2
d. lvdisplay
f. lvs
g. Use the lvscan command to scan all disks for logical volumes.
h. lvscan
j. pvs
l. vgs
2. ls -l /dev/myvolg/myvol
3. ls -l /dev/mapper/myvolg-myvol
5. ls -l /dev/dm-2
2. mkdir /myvol
9. umount /myvol
11. mount -a
12. Use the command df -h to verify your new file system is mounted.
13. df -h
2. vgs
4. lvs
6. df -h /myvol
10. vgs
14. df -h /myvol
16. ls -l /etc/lvm/backup
17. ls -l /etc/lvm/archive
2. pvs
4. vgs myvolg
8. pvs /dev/sdd2
12. ls -l /etc/lvm/backup
13. ls -l /etc/lvm/archive
4. lvs
6. df -h /myvol
2. fdisk -l /dev/sdb