“stratis”是 CentOS/RHEL 8 发行版中引入的新卷管理器。
这篇文章概述了在 CentOS/RHEL 8 系统中创建或者删除新的 Stratis 文件系统的步骤。
我们还将在这篇文章中看到如何挂载和卸载 Stratis 文件系统。
创建和挂载 Stratis 文件系统
- 安装 Stratis 包:
# rpm -qa | grep "strati*" stratisd-1.0.3-1.el8.x86_64 stratis-cli-1.0.2-1.el8.noarch
- 启用并启动stratisd服务:
# systemctl enable --now stratisd # systemctl start stratisd
验证stratisd服务的状态:
# systemctl status stratisd ● stratisd.service - A daemon that manages a pool of block devices to create flexible filesystems Loaded: loaded (/usr/lib/systemd/system/stratisd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2019-08-19 17:12:11 EDT; 1s ago Docs: man:stratisd(8) Main PID: 8642 (stratisd) Tasks: 1 (limit: 26213) Memory: 876.0K CGroup: /system.slice/stratisd.service └─8642 /usr/libexec/stratisd --debug
- 创建一个池:
# stratis pool create Stratis_Test /dev/sdb
验证我们刚刚创建的池:
# stratis pool list Name Total Physical Size Total Physical Used Stratis_Test 1.09 GiB 52 MiB
- 在新创建的“Stratis_Test”池上创建文件系统:
# stratis filesystem create Stratis_Test x01
验证文件系统创建:
# stratis filesystem list Pool Name Name Used Created Device UUID Stratis_Test x01 546 MiB Aug 19 2019 17:19 /stratis/Stratis_Test/x01 aa24d4adfd4342e38a1ffe0c5e7debe6
- 创建挂载点并挂载文件系统:
# mkdir /x01 # mount /stratis/Stratis_Test/x01 /x01
检查确认:
# df -h | grep /x01 /dev/mapper/stratis-1-6c2cd4f86a58439f9f1aa6a004b919db-thin-fs-aa24d4adfd4342e38a1ffe0c5e7debe6 1.0T 7.2G 1017G 1% /x01
# grep x01 /proc/mounts /dev/mapper/stratis-1-50fb0bbeb3e24ceaafd7be90917208df-thin-fs-9b9d33fac8734406907283fde7567889 /x01 xfs rw,seclabel,relatime,attr2,inode64,sunit=2048,swidth=2048,noquota 0 0
注意:如果需要向现有池添加更多块开发,请继续执行步骤 6.
- 向现有池添加更多的blockdev:
语法 :
pool add-data [pool_name] [blockdev] [[blockdev]..] Add one or more blockdevs to an existing pool, to enlarge its storage capacity.
在我们的例子中,命令是:
# stratis pool add-data Stratis_Test /dev/sdb
# stratis pool list Name Total Physical Size Total Physical Used Stratis_Test 1.09 GiB 598 MiB --------------- # stratis filesystem list Pool Name Name Used Created Device UUID Stratis_Test x01 546 MiB Aug 19 2019 17:19 /stratis/Stratis_Test/x01 aa24d4adfd4342e38a1ffe0c5e7debe6 # stratis blockdev list Pool Name Device Node Physical Size State Tier Stratis_Test /dev/sdb 1.09 GiB In-use Data
删除 Stratis 文件系统
- 检查池和文件系统配置:
# stratis pool list Name Total Physical Size Total Physical Used Stratis_Test 1.09 GiB 598 MiB
# stratis filesystem list Pool Name Name Used Created Device UUID Stratis_Test x01 546 MiB Aug 19 2019 17:19 /stratis/Stratis_Test/x01 aa24d4adfd4342e38a1ffe0c5e7debe6
# stratis blockdev list Pool Name Device Node Physical Size State Tier Stratis_Test /dev/sdb 1.09 GiB In-use Data
- 卸载文件系统并distroy 文件系统,然后是池。
# umount /x01 Destroy the stratis filesystem/pool # stratis fs destroy Stratis_Test x01 # stratis pool destroy Stratis_Test
- 验证:
# stratis pool list Name Total Physical Size Total Physical Used
# stratis filesystem list Pool Name Name Used Created Device UUID
# stratis blockdev list Pool Name Device Node Physical Size State Tier
欢迎来到之路教程(on itroad-com)
自动挂载文件系统
- 检查 UUID:
# blkid -p /stratis/Stratis_Test/x01 /stratis/Stratis_Test/x01: UUID="aa24d4ad-fd43-42e3-8a1f-fe0c5e7debe6" TYPE="xfs" USAGE="filesystem"
- 将 UUID 写入文件 /etc/fstab:
# echo "UUID="aa24d4ad-fd43-42e3-8a1f-fe0c5e7debe6 /x01 xfs defaults 0 0" >> /etc/fstab
# cat /etc/fstab /dev/mapper/ol-root / xfs defaults 0 0 UUID=0c39942a-a85b-454c-bdbc-44443874241e /boot xfs defaults 0 0 /dev/mapper/ol-swap swap swap defaults 0 0 UUID=9b9d33fa-c873-4406-9072-83fde7567889 /x01 xfs defaults 0 0
注意:如果我们已经安装了文件系统,请继续执行第 3 步,如果没有,请执行第 4 步。
- 卸载挂载点:
# umount /x01
- 使用 /etc/fstab 挂载挂载点:
# mount -a
# df -h | grep x01 Filesystem Size Used Avail Use% Mounted on /dev/mapper/stratis-1-6c2cd4f86a58439f9f1aa6a004b919db-thin-fs-aa24d4adfd4342e38a1ffe0c5e7debe6 1.0T 7.2G 1017G 1% /x01
日期:2020-09-17 00:14:18 来源:oir作者:oir