本文介绍如何通过向现有Stratis池中添加新磁盘和添加缓存磁盘。下面将介绍添加、删除、快照等内容。
系统环境
向Stratis池中添加其他磁盘
在Stratis管理下,将新的块设备添加到现有池非常容易。在上一篇文章《在Centos 中创建Stratis本地存储(一)》设置中,“ data01_pool”中有4个磁盘,现在我们需要通过添加新磁盘来扩展池中的空间。使用选项add-data来添加新磁盘,下面向"data01_pool"池中添加"/dev/sde"磁盘。
[root@localhost ~]# stratis pool list
Name Total Physical Properties
data01_pool 8 GiB / 1.11 GiB / 6.89 GiB ~Ca,~Cr
[root@localhost ~]# stratis pool add-data data01_pool /dev/sde
[root@localhost ~]# stratis pool list
Name Total Physical Properties
data01_pool 10 GiB / 1.12 GiB / 8.88 GiB ~Ca,~Cr

可以看到上图中扩展前是8G,扩展之后变成了10G。再查看一下stratis的块设备:
[root@localhost ~]# stratis blockdev list

重命名池和文件系统
Stratis具有在运行中重命名池或文件系统的功能,而不会影响任何正在运行的设置。下面让我们将当前池名称“data01_pool”重命名为“data01_pool_old”。
[root@localhost ~]# stratis pool rename data01_pool date01_pool_old

下面我们来重命名文件系统,重命名文件系统类似于重命名池:
[root@localhost ~]# stratis fs rename date01_pool_old user_data01 sys_data01

在Stratis中创建快照
Stratis可以对任何文件系统进行快照。让我们对服务器中现有文件系统进行快照。下面先再user_data01中写入一些数据:
[root@localhost ~]# touch /user_data01/file{1..100}.txt
下面来打快照:
[root@localhost ~]# stratis fs snapshot date01_pool_old sys_data01 sys_data01_snap

可以看到快照已生成。下面挂载/stratis/data01_pool_old/sys_data01_snap这个快照到/mnt目录,然后查看文件是否存在。
[root@localhost ~]# mount /stratis/date01_pool_old/sys_data01_snap /mnt/

删除Stratis文件系统
删除Stratis文件系统之前,需要再/etc/fstab中删除stratis相关的那两个文件系统条目。下面我只注释掉,没有删除条目。

卸载文件系统:
[root@localhost ~]# umount /user_data01
[root@localhost ~]# umount /user_data02
下面就开始删除文件系统啦:
[root@localhost ~]# stratis fs destroy date01_pool_old sys_data01
[root@localhost ~]# stratis fs destroy date01_pool_old user_data02
[root@localhost ~]# stratis fs destroy date01_pool_old sys_data01_snap
[root@localhost ~]# stratis fs destroy date01_pool_old user_data02_snap
删除Stratis池
要删除Stratis池,我们应该删除在其下创建的所有文件系统。否则会提示:
[root@localhost ~]# stratis pool destroy data01_pool_old
Execution failure caused by:
BUSY: filesystems remaining on pool
www.kejixun.com/article/170515/325313.shtml
server.51cto.com/ManageDC-517038.htm
www.techweb.com.cn/prnews/qiyenews/archives/15718.html
下面来删除池:
[root@localhost ~]# stratis pool destroy date01_pool_old
[root@localhost ~]# stratis pool
Name Total Physical Properties

总结
我们已经看到了如何通过添加磁盘并重命名来管理Stratis分层存储。
网友评论