• RHEL高级磁盘管理—Stratis


    2. Stratis

    本地存储管理工具,通过Stratis可以便捷的使用Thin Provisioning、Snapshots、Pool-based的管理和监控等高级存储功能。

    Stratis 基于xfs文件系统格式。

    2.1 Install

      # yum install -y stratisd stratis-cli
      # systemctl enable --now stratisd

    2.2 Create Pool

      # wipefs -a /dev/vdb  // 清除磁盘签名

      # wipefs -a /dev/vdc  // 清除磁盘签名

      # stratis pool create pool-1 /dev/vdb /dev/vdc
      # stratis pool list

    2.3 Extend Pool

      # stratis pool add-data pool-1 /dev/vdd

    2.4 BlockDevice

      # stratis blockdev list pool

    2.5 FileSystem

      # 在Pool创建FileSystem,可以在一个Pool中创建多个filesystem
      $ stratis filesystem create pool-1 file-1
      $ stratis filesystem list

    2.6 Mount FileSystem

      $ mount /stratis/pool-1/file-1 /mnt/

    2.7 Snapshot

      # 创建Snaphost这样做后,你可以挂载新的Snapshot,

      # 它将初始包含与FileSystem相同的文件内容,

      # 但它可能随着文件系统的修改而改变。

      # 无论你对Snapshot所做的任何更改都不会反映到FileSystem中,

      # 除非你卸载了FileSystem并将其销毁。

      $ stratis filesystem snapshot pool-1 file-1 snapshot-1

      $ mount /stratis/pool-1/snapshot-1 /mnt/

     

    RHEL高级磁盘管理—Stratis

    Stratis简介

    • RHEL8.0本地存储管理工具
    • 通过Stratis可以便捷的使用精简配置(Thin Provisioning)、快照(Snapshots)、基于池(Pool-based)的管理和监控等高级存储功能
    • Stratis 基于xfs文件系统格式,创建filesystem后不需要格式化;例如:在pool池中创建file文件系统,则file文件系统的类型已经是xfs格式,不需要在去格式化
    • 守护进程:stratisd

    安装Stratisd服务

    [root@localhost ~]# yum install -y stratisd stratis-cli
    [root@localhost ~]# systemctl enable --now stratisd
    

    使用Stratis的整体操作流程

    1. 选择完好的块设备(磁盘或者分区)
    2. 创建pool
    3. pool中创建文件系统(filesystem

    使用Stratis创建pool示例

    1. 创建完好的磁盘分区
    [root@localhost ~]# lsblk /dev/sda
    NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda      8:0    0  80G  0 disk 
    └─sda1   8:1    0  20G  0 part 
    
    1. 创建pool前查看块设备是否存在签名认证,如果有则必须先清除块设备上的签名认证,才能继续使用
    [root@localhost ~]# fdisk -l /dev/sda
    Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x4b000bc8
    

    Disklabel部分就是块设备的签名认证,需要清除该签名认证

    [root@localhost ~]# wipefs -a /dev/sda
    /dev/sda: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
    /dev/sda: calling ioctl to re-read partition table: Success
    

    清除后,再次查看块设备的签名信息

    [root@localhost ~]# fdisk -l /dev/sda
    Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    1. 创建pool池,一般是要求1G以上大小的块设备,才能创建pool
    [root@localhost ~]# stratis pool create pool-one /dev/sda1       //pool-one是pool的名称;/dev/sda1是拿来使用的块设备
    [root@localhost ~]# stratis pool list
    Name      Total Physical Size  Total Physical Used
    pool-one               20 GiB               52 MiB
    
    1. 向已经存在的pool池中添加块设备
    [root@localhost ~]# lsblk /dev/sda2
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda2   8:2    0  20G  0 part 
    [root@localhost ~]# stratis pool add-data pool-one /dev/sda2
    [root@localhost ~]# stratis pool list
    Name      Total Physical Size  Total Physical Used
    pool-one               40 GiB               72 MiB       //容量比原来扩大了
    
    1. 同时将两块块设备添加到同一个pool池中
    [root@localhost ~]# lsblk /dev/sda3 /dev/sda4
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda3   8:3    0  10G  0 part 
    sda4   8:4    0  20G  0 part 
    [root@localhost ~]# stratis pool create pool-two /dev/sda3 /dev/sda4
    [root@localhost ~]# stratis pool list
    Name      Total Physical Size  Total Physical Used
    pool-one               40 GiB               72 MiB
    pool-two               30 GiB               56 MiB
    
    1. 查看pool-one池和pool-two池中所使用的块设备
    [root@localhost ~]# stratis blockdev list pool-one
    Pool Name  Device Node  Physical Size  State  Tier
    pool-one   /dev/sda1           20 GiB  InUse  Data
    pool-one   /dev/sda2           20 GiB  InUse  Data
    [root@localhost ~]# stratis blockdev list pool-two
    Pool Name  Device Node  Physical Size  State  Tier
    pool-two   /dev/sda3           10 GiB  InUse  Data
    pool-two   /dev/sda4           20 GiB  InUse  Data
    
    1. 查看pool-one池和pool-two池中块设备的信息
    [root@localhost ~]# lsblk /dev/sda
    NAME                                                                      MAJ:MIN RM SIZE RO TYPE    MOUNTPOINT
    sda                                                                         8:0    0  80G  0 disk    
    ├─sda1                                                                      8:1    0  20G  0 part    
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-physical-originsub 253:3    0  40G  0 stratis 
    ├─stratis-1-private-2a5d0ca4266540b889057f37816c7423-flex-thinmeta    253:4    0  32M  0 stratis 
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-thinpool-pool  253:7    0  40G  0 stratis 
    ├─stratis-1-private-2a5d0ca4266540b889057f37816c7423-flex-thindata    253:5    0  40G  0 stratis 
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-thinpool-pool  253:7    0  40G  0 stratis 
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-flex-mdv         253:6    0  16M  0 stratis 
    ├─sda2                                                                      8:2    0  20G  0 part    
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-physical-originsub 253:3    0  40G  0 stratis 
    ├─stratis-1-private-2a5d0ca4266540b889057f37816c7423-flex-thinmeta    253:4    0  32M  0 stratis 
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-thinpool-pool  253:7    0  40G  0 stratis 
    ├─stratis-1-private-2a5d0ca4266540b889057f37816c7423-flex-thindata    253:5    0  40G  0 stratis 
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-thinpool-pool  253:7    0  40G  0 stratis 
    └─stratis-1-private-2a5d0ca4266540b889057f37816c7423-flex-mdv         253:6    0  16M  0 stratis 
    ├─sda3                                                                      8:3    0  10G  0 part    
    └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-physical-originsub 253:8    0  30G  0 stratis 
    ├─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-flex-thinmeta    253:9    0  16M  0 stratis 
    └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-thinpool-pool  253:12   0  30G  0 stratis 
    ├─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-flex-thindata    253:10   0  30G  0 stratis 
    └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-thinpool-pool  253:12   0  30G  0 stratis 
    └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-flex-mdv         253:11   0  16M  0 stratis 
    └─sda4                                                                      8:4    0  20G  0 part    
      └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-physical-originsub 253:8    0  30G  0 stratis 
        ├─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-flex-thinmeta    253:9    0  16M  0 stratis 
        └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-thinpool-pool  253:12   0  30G  0 stratis 
        ├─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-flex-thindata    253:10   0  30G  0 stratis 
        └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-thinpool-pool  253:12   0  30G  0 stratis 
        └─stratis-1-private-31db6de0edb64a3f8721a33f55922b69-flex-mdv         253:11   0  16M  0 stratis 
    

    使用Stratis创建filesystem示例

    1. pool-one池中创建filesystem(一次只能创建一个filesystem
    [root@localhost ~]# stratis filesystem create pool-one file-one      //pool-one是pool的名称;file-one是filesystem的名称
    [root@localhost ~]# stratis filesystem list          //列出已经拥有的filesystem
    Pool Name  Name      Used     Created            Device                      UUID                            
    pool-one   file-one  546 MiB  Sep 20 2020 20:33  /stratis/pool-one/file-one  deeb42ce571542cab33afcbfece6dd0a
    
    1. 查看指定pool池中拥有的filesystem
    [root@localhost ~]# stratis filesystem list pool-one
    Pool Name  Name      Used     Created            Device                      UUID                            
    pool-one   file-one  546 MiB  Sep 20 2020 20:33  /stratis/pool-one/file-one  deeb42ce571542cab33afcbfece6dd0a
    
    1. 挂载filesystem,挂载点:/fsdir
    [root@localhost ~]# mkdir /fsdir
    [root@localhost ~]# mount /stratis/pool-one/file-one /fsdir/
    [root@localhost ~]# df -h
    Filesystem                                                                                       Size  Used Avail Use% Mounted on
    devtmpfs                                                                                         886M     0  886M   0% /dev
    tmpfs                                                                                            903M     0  903M   0% /dev/shm
    tmpfs                                                                                            903M  8.7M  894M   1% /run
    tmpfs                                                                                            903M     0  903M   0% /sys/fs/cgroup
    /dev/mapper/rhel-root                                                                             50G  1.7G   49G   4% /
    /dev/nvme0n1p1                                                                                  1014M  173M  842M  17% /boot
    /dev/mapper/rhel-home                                                                             27G  225M   27G   1% /home
    tmpfs                                                                                            181M     0  181M   0% /run/user/0
    /dev/sr0                                                                                         7.4G  7.4G     0 100% /mnt
    /dev/mapper/stratis-1-2a5d0ca4266540b889057f37816c7423-thin-fs-deeb42ce571542cab33afcbfece6dd0a  1.0T  7.2G 1017G   1% /fsdir
    
    1. 写入到/etc/fstab配置文件中,建议使用UUID,因为使用name的话,每次更新name,都要对配置文件进行刷新
    [root@localhost ~]# blkid /stratis/pool-one/file-one 
    /stratis/pool-one/file-one: UUID="deeb42ce-5715-42ca-b33a-fcbfece6dd0a" TYPE="xfs"
    [root@localhost ~]# echo "UUID=deeb42ce-5715-42ca-b33a-fcbfece6dd0a     /fsdir   xfs   defaults    0 0" >> /etc/fstab  
    [root@localhost ~]# tail -3 /etc/fstab 
    /dev/mapper/rhel-home   /home                   xfs     defaults        0 0
    /dev/mapper/rhel-swap   swap                    swap    defaults        0 0
    UUID=deeb42ce-5715-42ca-b33a-fcbfece6dd0a     /fsdir   xfs   defaults    0 0
    
     
    分类: 磁盘管理
     

    Stratis文件系统

    由 自作多情 提交于 2020-01-06 18:58:11

    Red Hat Enterprise Linux 8中,引入新的存储管理系统Stratis。其功能总结如下:

    •     copy-on-write
    •     磁盘空间的精简置备Thin Provision
    •     支持RAID 0、RAID 1、RAID 10
    •     支持全盘加密如LUKS
    •     支持资源池,每池可创建 16,777,216( 2^24)个文件系统或文件夹
    •     LZ4压缩
    •     文件的消除重复功能
    •     子卷
    •     快照
    •     数据损坏的自愈功能
    •     热扩容、热减容
    •     为提升性能而进行存储分区:数据区和缓存区(与VMWare VMFS 6相同,与Glusterfs的热区、冷区类似)

    Stratis存储管理建立在Linux Mapper/ LVM及XFS的基础上,提供了便捷的管理功能,从某种程度上看,似乎就是一个本地版的Glusterfs。要使用Stratis,必须要安装Stratisd、stratis-cli两个软件包。创建过程如下:

    第1步:安装软件

    # yum install stratisd stratis-cli
    # systemctl enable --now stratisd

    第2步:创建资源池

    # stratis pool create mypool /dev/vdb

    在第二块虚拟磁盘/dev/vdb上创建了一个名叫mypool的资源池。

    第3步:创建文件系统

    # stratis filesystem create mypool myfls

    上面这条命令,在资源池mypool的基础上创建了文件系统myfls。

    第4步:挂载

    # mkdir /mnt/myfls
    # echo '/stratis/mypool/myfls   /mnt/myfls   xfs    defaults 0 0' >> /etc/fstab
    # mount -a
    # echo 'Hello, world' > /mnt/myfls/test.txt
    # cat /mnt/myfls/test.txt

    以上操作似乎少了点什么吧?对,似乎没有格式化就可以使用了。Stratis文件系统就是这么神奇。不需要你专门来格式化。

    第5步:资源池扩容

    # stratis pool add-data mypool /dev/vdc
  • 相关阅读:
    (转)建表参数(pctfree,IniTrans,maxtrans)含义
    oracle 中事务提交
    如何创建线程安全的list
    [转] Redis 存储List对象
    【转】 Oracle用户密码过期和用户被锁解决方法
    【转】oracle中rownum和row_number()
    [转]如何防止博客园文章被窃取
    【转】解锁 时 ORA-00942 表或视图不存在 问题的解决
    java 接口可以多继承--【转】http://blog.csdn.net/tiantiandjava/article/details/46514783
    echarts 问题
  • 原文地址:https://www.cnblogs.com/xuanbjut/p/14135317.html
Copyright © 2020-2023  润新知