block-storage
它能做什么
这个工具可以帮你管理电脑的存储空间。你可以用它添加、格式化、整理和保护磁盘及分区,还能使用 LVM、RAID 等高级功能。
适用场景
- ✓当你需要为服务器添加一块新硬盘时。
- ✓当你想用 LVM 灵活地划分磁盘空间时。
- ✓当你想为数据创建备份(快照)时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/block-storage/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何添加一块新硬盘,并将其格式化以便使用?”
每周 5 个新技能,1 分钟读完。
工作原理
它会在系统上运行命令,用来创建分区、文件系统(比如 ext4 或 XFS),以及管理逻辑卷(LVM)或 RAID 阵列。它还可以与云服务交互,管理虚拟磁盘。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Block Storage
Manage block storage volumes including LVM, cloud-based EBS, filesystem creation, snapshots, and RAID configurations. Covers the full lifecycle from provisioning raw disks to extending volumes in production.
When to Use
- Adding, partitioning, or formatting new disks on Linux servers
- Managing LVM logical volumes for flexible storage allocation
- Provisioning and attaching cloud block storage (AWS EBS)
- Creating and restoring snapshots for backup or migration
- Configuring software RAID for redundancy or performance
- Extending existing volumes without downtime
Prerequisites
- Root or sudo access on the target system
lvm2package installed for LVM operationsmdadmpackage installed for software RAID- AWS CLI configured for EBS operations
- Understanding of the workload's I/O characteristics (IOPS, throughput)
Disk Discovery and Partitioning
# List all block devices
lsblk
lsblk -f # Show filesystem types and mount points
# Show detailed disk information
fdisk -l /dev/sdb
# Identify disk model and health (requires smartmontools)
smartctl -a /dev/sda
smartctl -H /dev/sda # Quick health check
# Create a GPT partition table and a single partition
parted /dev/sdb mklabel gpt
parted /dev/sdb mkpart primary ext4 0% 100%
# Alternative: use fdisk for MBR partitioning
fdisk /dev/sdb
# n -> new partition, p -> primary, Enter defaults, w -> write
# Inform the kernel of partition table changes
partprobe /dev/sdb
# Wipe filesystem signatures (prepare for LVM or RAID)
wipefs -a /dev/sdb1
Filesystem Creation and Management
# Create an ext4 filesystem
mkfs.ext4 /dev/sdb1
# Create an ext4 filesystem with label and reserved block tuning
mkfs.ext4 -L appdata -m 1 /dev/sdb1 # 1% reserved blocks (default is 5%)
# Create an XFS filesystem (recommended for large volumes)
mkfs.xfs /dev/sdb1
# Create an XFS filesystem with label
mkfs.xfs -L appdata /dev/sdb1
# Mount the filesystem
mkdir -p /data
mount /dev/sdb1 /data
# Add persistent mount to fstab (use UUID for reliability)
blkid /dev/sdb1 # Get the UUID
echo 'UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /data ext4 defaults,noatime 0 2' >> /etc/fstab
# Mount all entries in fstab
mount -a
# Check and repair a filesystem (unmount first)
umount /data
fsck.ext4 -y /dev/sdb1
xfs_repair /dev/sdb1 # For XFS
# Resize ext4 (can grow online while mounted)
resize2fs /dev/sdb1
# Resize XFS (must be mounted to grow)
xfs_growfs /data
# Check filesystem usage
df -hT
LVM Management
Creating an LVM Stack
# Step 1: Create physical volumes
pvcreate /dev/sdb /dev/sdc
# View physical volumes
pvs
pvdisplay /dev/sdb
# Step 2: Create a volume group from physical volumes
vgcreate data_vg /dev/sdb /dev/sdc
# View volume groups
vgs
vgdisplay data_vg
# Step 3: Create logical volumes
# Fixed size
lvcreate -L 100G -n app_lv data_vg
# Use percentage of free space
lvcreate -l 50%FREE -n logs_lv data_vg
# Use all remaining space
lvcreate -l 100%FREE -n backup_lv data_vg
# View logical volumes
lvs
lvdisplay /dev/data_vg/app_lv
# Step 4: Create filesystem and mount
mkfs.ext4 /dev/data_vg/app_lv
mkdir -p /data/app
mount /dev/data_vg/app_lv /data/app
# Add to fstab
echo '/dev/data_vg/app_lv /data/app ext4 defaults,noatime 0 2' >> /etc/fstab
Extending Volumes (Online)
# Extend a logical volume by 20 GB
lvextend -L +20G /dev/data_vg/app_lv
# Extend to fill all free space in the VG
lvextend -l +100%FREE /dev/data_vg/app_lv
# Grow the ext4 filesystem (online, no unmount needed)
resize2fs /dev/data_vg/app_lv
# Grow XFS filesystem (online)
xfs_growfs /data/app
# Combined: extend LV and resize filesystem in one command
lvextend -L +20G --resizefs /dev/data_vg/app_lv
Adding a New Disk to an Existing VG
# Add a new physical volume
pvcreate /dev/sdd
# Extend the volume group
vgextend data_vg /dev/sdd
# Now extend any logical volume using the new space
lvextend -l +100%FREE --resizefs /dev/data_vg/app_lv
LVM Snapshots
# Create a snapshot (requires free space in VG)
lvcreate -L 10G -s -n app_snap /dev/data_vg/app_lv
# Mount the snapshot read-only for backup
mkdir -p /mnt/snapshot
mount -o ro /dev/data_vg/app_snap /mnt/snapshot
# Perform backup from the snapshot
tar czf /backup/app-$(date +%Y%m%d).tar.gz -C /mnt/snapshot .
# Unmount and remove the snapshot when done
umount /mnt/snapshot
lvremove -f /dev/data_vg/app_snap
…
常见问题
什么是 LVM?
LVM(Logical Volume Manager,逻辑卷管理器)是一种灵活管理磁盘的方式。它可以把多块物理磁盘合并成一个大的逻辑卷,让调整大小和整理空间变得更容易。
什么是快照?
快照就像是磁盘在某一时刻的“照片”。如果出现问题,你可以借助它恢复到之前的状态,也可以用于安全备份。
使用这个工具需要成为专家吗?
这个工具简化了很多操作,但了解一些计算机磁盘的基础知识会很有帮助。工具会提供命令,但你需要清楚自己想完成什么任务。
详情
作者的原始描述
Manage block storage volumes and LVM. Configure cloud block storage and local disks. Use when managing disk storage.
热度
- GitHub 星标
- 48k
- 排名
- #4036
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。