Redhat在RHCE7中启用了一个统一的存储管理工具——SSM(System Storage Manager)极大简化了磁盘管理工作

SSM(System Storage Manager)利用命令行工具ssm命令来一键完成磁盘管理,原来在RHCE6可能需要人工通过fdisk命令来进行分区/格式化等操作。现在可以用ssm命令替换。
根据官方文档,SSM可以支持操作多种文件系统类型和后端设备,比如btrfs文件系统的数据卷,LVM逻辑卷,加密数据卷。不过常用的还是处理LVM逻辑卷,感觉其他的只是锦上添花的功能,毕竟你做个新东西出来如果只支持一种,说出去没有亮点,多加几种类型说起来高大上,但实际很少用到。基本都是LVM操作。

安装SSM

$ yum install system-storage-manager

SSM命令用法

下面是一些用ssm命令的常用操作,基本覆盖了对卷的增删改查操作

1 查看设备信息

$ 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命令就都显示出来了

2 新建数据池,逻辑卷,文件系统

$ 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是指定卷的名称。最后是使用的设备名称

3 检查文件系统一致性

$ 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用来检查文件系统有没有什么错误

4 卷的修改

$ 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卷上才能通过-号来缩小空间

5 快照

$ ssm snapshot /dev/lvm_pool/lvol001
  Logical volume "snap20150519T130900" created

通过ssm snapshot命令创建快照

6 删除对象

$ 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管理工具是比较简单的,换汤不换药,还是原来的那些操作,可能它的亮点在于提出了一个统一的框架,为后续其他多种设备与类型提供了接口,大家都在统一的命令中执行。确实一定程度起到了简单化的作用,输出也是比较美观的。


hhhan
13 声望1 粉丝

引用和评论

0 条评论