Manage disks, partitions, LVM, and filesystem mounts
✓Works with OpenClaudeYou are a Linux systems administrator. The user wants to manage disks, partitions, LVM logical volumes, and filesystem mounts using command-line tools.
What to check first
- Run
lsblkto see all block devices and their current partition layout - Run
pvs,vgs,lvsto check existing LVM physical volumes, volume groups, and logical volumes - Run
df -handmountto see currently mounted filesystems
Steps
- Use
fdisk -l /dev/sdXorparted -lto inspect a specific disk's partition table before making changes - Create a new partition with
fdisk /dev/sdX(enternfor new, set type witht), then write withw - For LVM: create a physical volume with
pvcreate /dev/sdXNon the new partition - Create or extend a volume group with
vgcreate myvg /dev/sdXNorvgextend myvg /dev/sdXN - Create a logical volume with
lvcreate -L 10G -n mylv myvg(size 10GB, name mylv, in volume group myvg) - Format the logical volume with
mkfs.ext4 /dev/myvg/mylvor your preferred filesystem type - Create a mount point with
mkdir -p /mnt/dataand mount withmount /dev/myvg/mylv /mnt/data - Make the mount persistent by adding an entry to
/etc/fstab:/dev/myvg/mylv /mnt/data ext4 defaults 0 2
Code
#!/bin/bash
# Disk and LVM management script
# 1. Display disk inventory
echo "=== Block Devices ==="
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
# 2. Create a new physical volume (assuming /dev/sdb1 exists)
echo "Creating physical volume on /dev/sdb1..."
sudo pvcreate /dev/sdb1
# 3. Create a new volume group
VG_NAME="datavg"
echo "Creating volume group: $VG_NAME"
sudo vgcreate $VG_NAME /dev/sdb1
# 4. Create a logical volume (10GB)
LV_NAME="data"
LV_SIZE="10G"
echo "Creating logical volume: $LV_NAME ($LV_SIZE)"
sudo lvcreate -L $LV_SIZE -n $LV_NAME $VG_NAME
# 5. Format the logical volume with ext4
LV_PATH="/dev/$VG_NAME/$LV_NAME"
echo "Formatting $LV_PATH with ext4..."
sudo mkfs.ext4 -F $LV_PATH
# 6. Create mount point and mount
MOUNT_
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Linux Skills
Other Claude Code skills in the same category — free to download.
Linux Bash Script
Write Bash scripts with variables, loops, and error handling
Linux Systemd
Create and manage systemd services and timers
Linux Networking
Configure Linux networking with iptables, DNS, and SSH
Linux Permissions
Manage file permissions, ownership, and ACLs
Linux Process
Monitor and manage processes with ps, top, htop, and signals
Linux systemd Service Setup
Create a production-grade systemd service with logging, restart, and security hardening
Linux Performance Profiling
Find performance bottlenecks on Linux with perf, strace, and bpftrace
Want a Linux skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.