Redhat在RHCE7中启用了一个统一的存储管理工具——SSM(System Storage Manager)极大简化了磁盘管理工做
SSM(System Storage Manager)利用命令行工具ssm命令来一键完成磁盘管理,原来在RHCE6可能须要人工经过fdisk命令来进行分区/格式化等操做。如今能够用ssm命令替换。
根据官方文档,SSM能够支持操做多种文件系统类型和后端设备,好比btrfs文件系统的数据卷,LVM逻辑卷,加密数据卷。不过经常使用的仍是处理LVM逻辑卷,感受其余的只是锦上添花的功能,毕竟你作个新东西出来若是只支持一种,说出去没有亮点,多加几种类型提及来高大上,但实际不多用到。基本都是LVM操做。node
$ yum install system-storage-manager
下面是一些用ssm命令的经常使用操做,基本覆盖了对卷的增删改查操做后端
$ ssm list ---------------------------------------------------------- Device Free Used Total Pool Mount point ---------------------------------------------------------- /dev/sda 2.00 GB PARTITIONED /dev/sda1 47.83 MB /test /dev/vda 15.00 GB PARTITIONED /dev/vda1 500.00 MB /boot /dev/vda2 0.00 KB 14.51 GB 14.51 GB rhel ---------------------------------------------------------- ------------------------------------------------ Pool Type Devices Free Used Total ------------------------------------------------ rhel lvm 1 0.00 KB 14.51 GB 14.51 GB ------------------------------------------------ --------------------------------------------------------------------------------- Volume Pool Volume size FS FS size Free Type Mount point --------------------------------------------------------------------------------- /dev/rhel/root rhel 13.53 GB xfs 13.52 GB 9.64 GB linear / /dev/rhel/swap rhel 1000.00 MB linear /dev/sda1 47.83 MB xfs 44.50 MB 44.41 MB part /test /dev/vda1 500.00 MB xfs 496.67 MB 403.56 MB part /boot ---------------------------------------------------------------------------------
能够看到基本把经常使用的用来查看磁盘信息的命令作了一个汇总,只要用一个ssm list
命令就都显示出来了app
$ ssm create --fs xfs -p new_pool -n XFS_Volume /dev/vdd Volume group "new_pool" successfully created Logical volume "XFS_Volume" created
新建的命令是ssm create
, 参数 --fs
是指定文件系统类型,参数-p
是指定数据池的名称,参数 -n
是指定卷的名称。最后是使用的设备名称框架
$ ssm check /dev/lvm_pool/lvol001 Checking xfs file system on '/dev/mapper/lvm_pool-lvol001'. Phase 1 - find and verify superblock... Phase 2 - using internal log - scan filesystem freespace and inode maps... - found root inode chunk Phase 3 - for each AG... - scan (but don't clear) agi unlinked lists... - process known inodes and perform inode discovery... - agno = 0 - agno = 1 - agno = 2 - agno = 3 - agno = 4 - agno = 5 - agno = 6 - process newly discovered inodes... Phase 4 - check for duplicate blocks... - setting up duplicate extent list... - check for inodes claiming duplicate blocks... - agno = 0 - agno = 1 - agno = 2 - agno = 3 - agno = 4 - agno = 5 - agno = 6 No modify flag set, skipping phase 5 Phase 6 - check inode connectivity... - traversing filesystem ... - traversal finished ... - moving disconnected inodes to lost+found ... Phase 7 - verify link counts... No modify flag set, skipping filesystem flush and exiting.
ssm check命令相似于fsck用来检查文件系统有没有什么错误工具
$ ssm resize -s +500M /dev/lvm_pool/lvol001 /dev/vdc Physical volume "/dev/vdc" successfully created Volume group "lvm_pool" successfully extended Phase 1 - find and verify superblock... Phase 2 - using internal log - scan filesystem freespace and inode maps... - found root inode chunk Phase 3 - for each AG... - scan (but don't clear) agi unlinked lists... - process known inodes and perform inode discovery... - agno = 0 - agno = 1 - agno = 2 - agno = 3 - process newly discovered inodes... Phase 4 - check for duplicate blocks... - setting up duplicate extent list... - check for inodes claiming duplicate blocks... - agno = 0 - agno = 1 - agno = 2 - agno = 3 No modify flag set, skipping phase 5 Phase 6 - check inode connectivity... - traversing filesystem ... - traversal finished ... - moving disconnected inodes to lost+found ... Phase 7 - verify link counts... No modify flag set, skipping filesystem flush and exiting. Extending logical volume lvol001 to 1.37 GiB Logical volume lvol001 successfully resized meta-data=/dev/mapper/lvm_pool-lvol001 isize=256 agcount=4, agsize=57600 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 data = bsize=4096 blocks=230400, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =internal bsize=4096 blocks=853, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 230400 to 358400
经过ssm resize
命令能够修改卷的大小,-s
参数能够设置修改空间的幅度,上述命令增长了500M,只有在LVM卷上才能经过-
号来缩小空间加密
$ ssm snapshot /dev/lvm_pool/lvol001 Logical volume "snap20150519T130900" created
经过ssm snapshot
命令建立快照spa
$ ssm remove lvm_pool Do you really want to remove volume group "lvm_pool" containing 2 logical volumes? [y/n]: y Do you really want to remove active logical volume snap20150519T130900? [y/n]: y Logical volume "snap20150519T130900" successfully removed Do you really want to remove active logical volume lvol001? [y/n]: y Logical volume "lvol001" successfully removed Volume group "lvm_pool" successfully removed
ssm remove
命令能够删除以前建立的设备,数据池,或卷。能够经过-f
参数强制删除。命令行
咱们能够看到SSM管理工具是比较简单的,换汤不换药,仍是原来的那些操做,可能它的亮点在于提出了一个统一的框架,为后续其余多种设备与类型提供了接口,你们都在统一的命令中执行。确实必定程度起到了简单化的做用,输出也是比较美观的。code