介绍
SSM(System Storage Manager)是系统存储管理器,它是一种统一的命令行界面,用于管理各种存储设备。通过SSM,用户可以方便地管理、配置和监控存储系统。检查关于可用硬驱和LVM卷的信息。显示关于现有磁盘存储设备、存储池、LVM卷和存储快照的信息。
安装
yum install -y system-storage-manager
语法及参数
#相关参数
[root@localhost ~]# ssm -h
usage: ssm [-h] [--version] [-v] [-f] [-b BACKEND] [-n]
{check,resize,create,list,add,remove,snapshot,mount} ...
System Storage Manager
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-v, --verbose Show aditional information while executing.
-f, --force Force execution in the case where ssm has some doubts
or questions.
-b BACKEND, --backend BACKEND
Choose backend to use. Currently you can choose from
(lvm,btrfs,crypt).
-n, --dry-run Dry run. Do not do anything, just parse the command
line options and gather system information if
necessary. Note that with this option ssm will not
perform all the check as some of them are done by the
backends themselves. This option is mainly used for
debugging purposes, but still requires root
privileges.
Commands:
{check,resize,create,list,add,remove,snapshot,mount}
check Check consistency of the file system on the device.
resize Change or set the volume and file system size.
create Create a new volume with defined parameters.
list List information about all detected, devices, pools,
volumes and snapshots in the system.
add Add one or more devices into the pool.
remove Remove devices from the pool, volumes or pools.
snapshot Take a snapshot of the existing volume.
mount Mount a volume with file system to specified locaion.
To get help for particular command please specify 'ssm [command] -h'.
查看磁盘信息
#列出设备信息
[root@localhost ~]# ssm list dev
-----------------------------------------------------------
Device Free Used Total Pool Mount point
-----------------------------------------------------------
/dev/sda 20.00 GB
/dev/sda1 1.00 GB /boot
/dev/sda2 0.00 KB 19.00 GB 19.00 GB centos
/dev/sdb 20.00 GB
/dev/sdb1 2.00 GB
/dev/sdb2 2.00 GB
/dev/sdb3 5.00 GB
/dev/sdb4 11.00 GB
-----------------------------------------------------------
#列出存储池信息
[root@localhost ~]# ssm list pool
--------------------------------------------------
Pool Type Devices Free Used Total
--------------------------------------------------
centos lvm 1 0.00 KB 19.00 GB 19.00 GB
--------------------------------------------------
创建资源池并设置LVM卷
创建一个名为wyh的LVM存储池,并在其上创建一个名为wyh-lv,初始大小为1G的lvm卷,格式化为xfs文件系统,并将其挂载/wyh-lv目录下。此存储池中的空间后期要可以动态扩容。
#创建挂载目录wyh-lv
[root@localhost ~]# mkdir /wyh-lv
#执行ssm命令
[root@localhost ~]# ssm create -s 1G -n wyh-lv --fstype xfs -p wyh /dev/sdb[1-2] /wyh-lv/
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdb2" successfully created.
Volume group "wyh" successfully created
Logical volume "wyh-lv" created.
meta-data=/dev/wyh/wyh-lv isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# df -h /wyh-lv/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/wyh-wyh--lv 1014M 33M 982M 4% /wyh-lv
[root@localhost ~]# ssm list dev
--------------------------------------------------------------
Device Free Used Total Pool Mount point
--------------------------------------------------------------
/dev/sda 20.00 GB
/dev/sda1 1.00 GB /boot
/dev/sda2 0.00 KB 19.00 GB 19.00 GB centos
/dev/sdb 20.00 GB
/dev/sdb1 1020.00 MB 1.00 GB 2.00 GB wyh
/dev/sdb2 2.00 GB 0.00 KB 2.00 GB wyh
/dev/sdb3 5.00 GB
/dev/sdb4 11.00 GB
--------------------------------------------------------------
[root@localhost ~]# ssm list pool
--------------------------------------------------
Pool Type Devices Free Used Total
--------------------------------------------------
centos lvm 1 0.00 KB 19.00 GB 19.00 GB
wyh lvm 2 2.99 GB 1.00 GB 3.99 GB
--------------------------------------------------
LVM卷扩容
[root@localhost ~]# lvextend -L +500M -r /dev/wyh/wyh-lv
Size of logical volume wyh/wyh-lv changed from 1.00 GiB (256 extents) to <1.49 GiB (381 extents).
Logical volume wyh/wyh-lv successfully resized.
meta-data=/dev/mapper/wyh-wyh--lv isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 262144 to 390144
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
├─sdb1 8:17 0 2G 0 part
│ └─wyh-wyh--lv 253:2 0 1.5G 0 lvm /wyh-lv
├─sdb2 8:18 0 2G 0 part
├─sdb3 8:19 0 5G 0 part
└─sdb4 8:20 0 11G 0 part
[root@localhost ~]# ssm list pool
--------------------------------------------------
Pool Type Devices Free Used Total
--------------------------------------------------
centos lvm 1 0.00 KB 19.00 GB 19.00 GB
wyh lvm 2 2.50 GB 1.49 GB 3.99 GB
--------------------------------------------------
[root@localhost ~]# ssm list dev
-------------------------------------------------------------
Device Free Used Total Pool Mount point
-------------------------------------------------------------
/dev/sda 20.00 GB
/dev/sda1 1.00 GB /boot
/dev/sda2 0.00 KB 19.00 GB 19.00 GB centos
/dev/sdb 20.00 GB
/dev/sdb1 520.00 MB 1.49 GB 2.00 GB wyh
/dev/sdb2 2.00 GB 0.00 KB 2.00 GB wyh
/dev/sdb3 5.00 GB
/dev/sdb4 11.00 GB
-------------------------------------------------------------
为资源池添加磁盘
[root@localhost ~]# ssm add -p wyh /dev/sdb3
Physical volume "/dev/sdb3" successfully created.
Volume group "wyh" successfully extended
[root@localhost ~]# ssm list dev
-------------------------------------------------------------
Device Free Used Total Pool Mount point
-------------------------------------------------------------
/dev/sda 20.00 GB
/dev/sda1 1.00 GB /boot
/dev/sda2 0.00 KB 19.00 GB 19.00 GB centos
/dev/sdb 20.00 GB
/dev/sdb1 520.00 MB 1.49 GB 2.00 GB wyh
/dev/sdb2 2.00 GB 0.00 KB 2.00 GB wyh
/dev/sdb3 5.00 GB 0.00 KB 5.00 GB wyh
/dev/sdb4 11.00 GB
-------------------------------------------------------------
[root@localhost ~]# ssm list pool
--------------------------------------------------
Pool Type Devices Free Used Total
--------------------------------------------------
centos lvm 1 0.00 KB 19.00 GB 19.00 GB
wyh lvm 3 7.50 GB 1.49 GB 8.99 GB
--------------------------------------------------
删除资源池内磁盘
[root@localhost ~]# ssm remove /dev/sdb3
Removed "/dev/sdb3" from volume group "wyh"
[root@localhost ~]# ssm remove /dev/sdb2
Removed "/dev/sdb2" from volume group "wyh"
[root@localhost ~]# ssm list dev
-------------------------------------------------------------
Device Free Used Total Pool Mount point
-------------------------------------------------------------
/dev/sda 20.00 GB
/dev/sda1 1.00 GB /boot
/dev/sda2 0.00 KB 19.00 GB 19.00 GB centos
/dev/sdb 20.00 GB
/dev/sdb1 520.00 MB 1.49 GB 2.00 GB wyh
/dev/sdb2 2.00 GB
/dev/sdb3 5.00 GB
/dev/sdb4 11.00 GB
-------------------------------------------------------------
[root@localhost ~]# ssm list pool
----------------------------------------------------
Pool Type Devices Free Used Total
----------------------------------------------------
centos lvm 1 0.00 KB 19.00 GB 19.00 GB
wyh lvm 1 520.00 MB 1.49 GB 2.00 GB
----------------------------------------------------
删除资源池
#对挂载目录进行卸载
[root@localhost ~]# umount /wyh-lv/
#删除资源池wyh
[root@localhost ~]# ssm remove wyh
Do you really want to remove volume group "wyh" containing 1 logical volumes? [y/n]: y
Do you really want to remove active logical volume wyh/wyh-lv? [y/n]: y
Logical volume "wyh-lv" successfully removed
Volume group "wyh" successfully removed
[root@localhost ~]# ssm list pool
--------------------------------------------------
Pool Type Devices Free Used Total
--------------------------------------------------
centos lvm 1 0.00 KB 19.00 GB 19.00 GB
--------------------------------------------------
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
├─sdb1 8:17 0 2G 0 part
├─sdb2 8:18 0 2G 0 part
├─sdb3 8:19 0 5G 0 part
└─sdb4 8:20 0 11G 0 part
[root@localhost ~]# ll /wyh-lv/
total 0
[root@localhost ~]# df -h /wyh-lv/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 17G 1.4G 16G 8% /
分享、在看与点赞
只要你点,我们就是胖友
来自: Linux lvm卷扩容之SSMhttps://mp.weixin.qq.com/s?__biz=Mzk0NTQ3OTk3MQ==&mid=2247486660&idx=1&sn=bc98e17c62d32b31e3d1f46c8ef78e0f&chksm=c3158488f4620d9ea4a4a2605e15a3758916508f51e1591b542b61e9ce5159a1ef0edcee968b&token=355315523&lang=zh_CN#rd