updated solutions for practice scenerios
This commit is contained in:
@@ -56,3 +56,127 @@ df -h
|
|||||||
- Storage Troubleshooting
|
- Storage Troubleshooting
|
||||||
|
|
||||||
[Additional scenarios will be documented here as completed]
|
[Additional scenarios will be documented here as completed]
|
||||||
|
|
||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scenario: Create a new 2GB partition on /dev/sdb and extend the logical volume by 500MB using LVM
|
||||||
|
|
||||||
|
### Original Problem
|
||||||
|
- Create a new 2GB partition on /dev/sdb
|
||||||
|
- Create a physical volume from this partition
|
||||||
|
- Create a volume group called 'datavg'
|
||||||
|
- Create a 1GB logical volume called 'datalv'
|
||||||
|
- Format the logical volume with XFS filesystem
|
||||||
|
- Mount it persistently at /mnt/data using UUID
|
||||||
|
- Extend the logical volume by 500MB
|
||||||
|
|
||||||
|
### Environment
|
||||||
|
- OS Version: RHEL/Rocky Linux
|
||||||
|
- Initial State: No partition on /dev/sdb
|
||||||
|
- Required Outcome: /dev/sdb1 as a physical volume, datavg volume group, datalv logical volume, /mnt/data mounted with XFS filesystem, 1.5GB of space available
|
||||||
|
|
||||||
|
### Solution Steps
|
||||||
|
1. Check Current Storage Configuration
|
||||||
|
```bash
|
||||||
|
# List block devices
|
||||||
|
lsblk -f
|
||||||
|
|
||||||
|
# Check existing volume groups
|
||||||
|
sudo vgs
|
||||||
|
```
|
||||||
|
The output should show no partitions on /dev/sdb
|
||||||
|
|
||||||
|
2. Create a new 2GB partition on /dev/sdb
|
||||||
|
```bash
|
||||||
|
# Create a new 2GB partition on /dev/sdb
|
||||||
|
sudo fdisk /dev/sdb
|
||||||
|
|
||||||
|
# Select the option to create a new partition
|
||||||
|
n
|
||||||
|
|
||||||
|
# Select the default partition number
|
||||||
|
p
|
||||||
|
|
||||||
|
# Select the default starting sector
|
||||||
|
Enter
|
||||||
|
|
||||||
|
# Select the default ending sector
|
||||||
|
+2G
|
||||||
|
|
||||||
|
# Write the changes
|
||||||
|
w
|
||||||
|
```
|
||||||
|
The output should show a new partition on /dev/sdb1
|
||||||
|
|
||||||
|
3. Create a physical volume from this partition
|
||||||
|
```bash
|
||||||
|
# Create a physical volume from this partition
|
||||||
|
sudo pvcreate /dev/sdb1
|
||||||
|
```
|
||||||
|
The output should show a new physical volume on /dev/sdb1
|
||||||
|
|
||||||
|
4. Create a volume group called 'datavg'
|
||||||
|
```bash
|
||||||
|
# Create a volume group called 'datavg'
|
||||||
|
sudo vgcreate datavg /dev/sdb1
|
||||||
|
```
|
||||||
|
The output should show a new volume group called 'datavg'
|
||||||
|
|
||||||
|
5. Create a 1GB logical volume called 'datalv'
|
||||||
|
```bash
|
||||||
|
# Create a 1GB logical volume called 'datalv'
|
||||||
|
sudo lvcreate -n datalv -L 1G datavg
|
||||||
|
```
|
||||||
|
The output should show a new logical volume called 'datalv'
|
||||||
|
|
||||||
|
6. Format the logical volume with XFS filesystem
|
||||||
|
```bash
|
||||||
|
# Format the logical volume with XFS filesystem
|
||||||
|
sudo mkfs.xfs /dev/datavg/datalv
|
||||||
|
```
|
||||||
|
The output should show a new XFS filesystem on /dev/datavg/datalv
|
||||||
|
|
||||||
|
7. Mount it persistently at /mnt/data using UUID
|
||||||
|
```bash
|
||||||
|
# Mount it persistently at /mnt/data using UUID
|
||||||
|
sudo mkdir -p /mnt/data
|
||||||
|
|
||||||
|
# Check the UUID of the logical volume
|
||||||
|
lsblk -f
|
||||||
|
|
||||||
|
# Mount the logical volume using /etc/fstab and UUID
|
||||||
|
sudo echo "UUID=3cf01c3e-6a65-42e7-bd3c-67d32a973cce /mnt/data xfs defaults 0 0" >> /etc/fstab
|
||||||
|
|
||||||
|
# Mount the logical volume
|
||||||
|
sudo mount -a
|
||||||
|
```
|
||||||
|
The output should show the logical volume mounted at /mnt/data
|
||||||
|
|
||||||
|
8. Extend the logical volume by 500MB
|
||||||
|
```bash
|
||||||
|
# Extend the logical volume by 500MB
|
||||||
|
sudo lvextend -L +500M /dev/datavg/datalv
|
||||||
|
```
|
||||||
|
The output should show the logical volume extended by 500MB
|
||||||
|
|
||||||
|
### Verification
|
||||||
|
```bash
|
||||||
|
# Verification commands
|
||||||
|
pvs
|
||||||
|
vgs
|
||||||
|
lvs
|
||||||
|
df -h
|
||||||
|
lsblk -f
|
||||||
|
```
|
||||||
|
|
||||||
|
### Key Learnings
|
||||||
|
- Understanding of LVM concepts
|
||||||
|
- Storage management best practices
|
||||||
|
- Importance of verification
|
||||||
|
|
||||||
|
## Skills Demonstrated
|
||||||
|
- LVM Management
|
||||||
|
- Disk Partitioning
|
||||||
|
- Filesystem Management
|
||||||
|
- Storage Troubleshooting
|
||||||
Reference in New Issue
Block a user