logical volumes
Jamal was a star athlete in high school. He learned the discipline of practice at an early age. Now he is mastering setting up Logical Volumes as a RHEL Engineering at Red Hat. He believes strongly in muscle memory and repetition to build mastery. Please walk him through one cycle of all the commands that it would take from buying two 10 TB hard drives on Amazon, installing them, and creating two Logical Volumes (8 TB and 16 TB). The Logical Volumes will be named in honor of two of his Teacher: Brother_Michael_M and Father_Frank_R.
Sure, here are the steps that Jamal can follow to set up Logical Volumes using two 10 TB hard drives:
- Purchase two 10 TB hard drives on Amazon and install them into your server.
- Run
lsblk
to view the current block devices and partitions on your server. Note the names of the two new hard drives (e.g./dev/sdb
and/dev/sdc
). - Use
fdisk
to create a new partition on each hard drive:- sudo fdisk /dev/sdb
n
p
1
<enter>
<enter>
t
8e
w
sudo fdisk /dev/sdc
n
p
1
<enter>
<enter>
t
8e
w - These commands create a new partition on each hard drive, set the partition type to
8e
(Linux LVM), and save the changes.
- sudo fdisk /dev/sdb
- Use
pvcreate
to create physical volumes on each partition:- sudo pvcreate /dev/sdb1
sudo pvcreate /dev/sdc1 - These commands create physical volumes on each partition.
- sudo pvcreate /dev/sdb1
- Use
vgcreate
to create a new volume group:- sudo vgcreate MyVolumeGroup /dev/sdb1 /dev/sdc1
- This command creates a new volume group called
MyVolumeGroup
that spans both physical volumes.
- Use
lvcreate
to create two logical volumes:- sudo lvcreate -L 8T -n Brother_Michael_M MyVolumeGroup
sudo lvcreate -L 16T -n Father_Frank_R MyVolumeGroup - These commands create two logical volumes within the volume group
MyVolumeGroup
. The first logical volume is namedBrother_Michael_M
and has a size of 8 terabytes, while the second logical volume is namedFather_Frank_R
and has a size of 16 terabytes.
- sudo lvcreate -L 8T -n Brother_Michael_M MyVolumeGroup
- Use
mkfs.ext4
to format each logical volume with the ext4 file system:- sudo mkfs.ext4 /dev/MyVolumeGroup/Brother_Michael_M
sudo mkfs.ext4 /dev/MyVolumeGroup/Father_Frank_R - These commands format each logical volume with the ext4 file system.
- sudo mkfs.ext4 /dev/MyVolumeGroup/Brother_Michael_M
- Use
mkdir
to create two directories for each logical volume:- sudo mkdir /mnt/Brother_Michael_M
sudo mkdir /mnt/Father_Frank_R - These commands create two directories for each logical volume.
- sudo mkdir /mnt/Brother_Michael_M
- Use
mount
to mount each logical volume to its corresponding directory:- sudo mount /dev/MyVolumeGroup/Brother_Michael_M /mnt/Brother_Michael_M
sudo mount /dev/MyVolumeGroup/Father_Frank_R /mnt/Father_Frank_R
- sudo mount /dev/MyVolumeGroup/Brother_Michael_M /mnt/Brother_Michael_M
These commands mount each logical volume to its corresponding directory.
After completing these steps, Jamal should have two logical volumes named Brother_Michael_M
and Father_Frank_R
, with sizes of 8 TB and 16 TB respectively, mounted to /mnt/Brother_Michael_M
and /mnt/Father_Frank_R
. These logical volumes can be used for storing and accessing data.