統一系統存儲管理器SSM

Redhat在RHCE7中啓用了一個統一的存儲管理工具——SSM(System Storage Manager)極大簡化了磁盤管理工做

SSM(System Storage Manager)利用命令行工具ssm命令來一鍵完成磁盤管理,原來在RHCE6可能須要人工經過fdisk命令來進行分區/格式化等操做。如今能夠用ssm命令替換。
根據官方文檔,SSM能夠支持操做多種文件系統類型和後端設備,好比btrfs文件系統的數據卷,LVM邏輯卷,加密數據卷。不過經常使用的仍是處理LVM邏輯卷,感受其餘的只是錦上添花的功能,畢竟你作個新東西出來若是隻支持一種,說出去沒有亮點,多加幾種類型提及來高大上,但實際不多用到。基本都是LVM操做。node

安裝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命令就都顯示出來了app

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命令建立快照spa

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管理工具是比較簡單的,換湯不換藥,仍是原來的那些操做,可能它的亮點在於提出了一個統一的框架,爲後續其餘多種設備與類型提供了接口,你們都在統一的命令中執行。確實必定程度起到了簡單化的做用,輸出也是比較美觀的。code

相關文章
相關標籤/搜索