RHEL_高级磁盘管理(vdo、stratis)
RHEL高级磁盘管理—VDO
VDO简介
Virtual Data Optimizer通过数据去重、压缩的方式来优化存储空间。VDO层放置在现有块存储设备上,例如Raid设备、本地磁盘设备。LVM或文件系统 放置在VDO层之上,也可以将VDO放在LVM层之上VDO工具需要用户手动安装,安装完成后即可使用vdo命令创建、添加、删除、激活、停止等操作
VDO安装
[root@localhost ~]# yum install -y vdo
vdo常用的选项
- vdo语法:
vdo command - command常用的参数:
 
create              创建一个VDO卷及其关联索引使其可用。
remove              删除一个或多个已停止的VDO卷和相关卷索引。
modify              修改一个或所有VDO的配置参数卷。更改将在VDO下次运行时生效设备启动;已经运行的设备则不是受到影响。
list                显示已启动VDO卷的列表。如果,所有指定它同时显示已启动和未启动卷。
start               启动一个或多个已停止、激活的VDO卷相关的服务。
status              以YAML格式报告VDO系统和卷状态。但是,这个命令不需要root特权如果没有,信息将是不完整的。
stop                停止一个或多个正在运行的VDO卷和相关卷服务。
activate            激活一个或多个VDO卷。激活卷可以使用“开始”命令启动。
deactivate          使一个或多个VDO卷失效。停用不能通过“start”命令启动卷。停用当前正在运行的卷不会停止它。
growLogical         增加VDO卷的逻辑大小。卷必须存在并且必须正在运行。
growPhysical        增加VDO卷的物理大小。卷必须存在并且必须正在运行。
使用vdo示例
目标: 使用为分区的磁盘,创建名为vdoname的vdo卷,并挂载到/vdodir目录下,并且能开机自定挂载
- 查看已经存在的未分区的磁盘
 
[root@localhost ~]# lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda    8:0    0  80G  0 disk
使用磁盘分区创建vdo卷(也可以使用整个未分区的磁盘创建分区,在分区上创建vdo卷;如果使用这种方法,首先要清除磁盘上的签名)
- 创建一个磁盘分区
 
[root@localhost ~]# fdisk /dev/sda 
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-167772159, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-167772159, default 167772159): +20G
Created a new partition 1 of type 'Linux' and of size 20 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
- 查看该磁盘分区
 
[root@localhost ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   80G  0 disk
└─sda1          8:1    0   20G  0 part         //这是刚刚创建的磁盘分区
sr0            11:0    1  7.3G  0 rom  /mnt
nvme0n1       259:0    0   80G  0 disk
├─nvme0n1p1   259:1    0    1G  0 part /boot
└─nvme0n1p2   259:2    0   79G  0 part
  ├─rhel-root 253:0    0   50G  0 lvm  /
  ├─rhel-swap 253:1    0    2G  0 lvm  [SWAP]
  └─rhel-home 253:2    0   27G  0 lvm  /home
- 在/dev/sda1上创建vdo卷(注意:创建的分区不需要格式化)
 
[root@localhost ~]# vdo create --name=vdoname --device=/dev/sda1 --vdoLogicalSize=8G
Creating VDO vdoname
Starting VDO vdoname
Starting compression on VDO vdoname
VDO instance 2 volume is ready at /dev/mapper/vdoname
- 查看已经创建的vdo卷
 
[root@localhost ~]# vdo list
vdoname
或者使用lsblk查看
[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
  └─vdoname 253:3    0   8G  0 vdo
- 格式化vdo卷,格式化类型xfs
 
[root@localhost ~]# mkfs.xfs /dev/mapper/vdoname
meta-data=/dev/mapper/vdoname    isize=512    agcount=4, agsize=524288 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=2097152, 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=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
- 查看已经创建的vdo卷的属性
 
[root@localhost ~]# vdostats --si
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdoname      21.5G      4.3G     17.2G  20%           99%
或者使用blkid查看
[root@localhost ~]# blkid /dev/mapper/vdoname
/dev/mapper/vdoname: UUID="e7bf09bb-1203-4eef-8837-cd802ef11ded" TYPE="xfs"
- 挂载vdo卷,挂载目录
/vdodir 
[root@localhost ~]# mkdir /vdodir
[root@localhost ~]# mount /dev/mapper/vdoname /vdodir/
[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.6M  894M   1% /run
tmpfs                  903M     0  903M   0% /sys/fs/cgroup
/dev/mapper/rhel-root   50G  2.2G   48G   5% /
/dev/mapper/rhel-home   27G  225M   27G   1% /home
/dev/nvme0n1p1        1014M  171M  844M  17% /boot
tmpfs                  181M     0  181M   0% /run/user/0
/dev/sr0               7.4G  7.4G     0 100% /mnt
/dev/mapper/vdoname    8.0G   90M  8.0G   2% /vdodir         //已经挂载成功
- 查看挂载后的vdo卷的信息
 
[root@localhost ~]# vdostats --si
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdoname      21.5G      4.3G     17.2G  20%           98%
[root@localhost ~]# lsblk /dev/mapper/vdoname
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdoname 253:3    0   8G  0 vdo  /vdodir
- 开机自动挂载vdo卷
 
[root@localhost ~]# echo "/dev/mapper/vdoname    /vdodir      xfs     defaults  0 0" >> /etc/fstab
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Aug 26 03:25:38 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/rhel-root   /                       xfs     defaults        0 0
UUID=234365dc-2262-452e-9cbb-a6acfde04385 /boot                   xfs     defaults        0 0
/dev/mapper/rhel-home   /home                   xfs     defaults        0 0
/dev/mapper/rhel-swap   swap                    swap    defaults        0 0
/dev/mapper/vdoname    /vdodir      xfs     defaults  0 0
- 删除一个vdo卷
 
[root@localhost ~]# umount /vdodir/        //如果已经挂载,需要先卸载
[root@localhost ~]# vdo remove --name=vdoname
Removing VDO vdoname
Stopping VDO vdoname
[root@localhost ~]# vdo list
或者使用lsblk查看
[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
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的整体操作流程
- 选择完好的块设备(磁盘或者分区)
 - 创建
pool - 在
pool中创建文件系统(filesystem) 
使用Stratis创建pool示例
- 创建完好的磁盘分区
 
[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
- 创建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
- 创建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
- 向已经存在的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       //容量比原来扩大了
- 同时将两块块设备添加到同一个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
- 查看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
- 查看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示例
- 在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
- 查看指定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
- 挂载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
- 写入到/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
												
											RHEL_高级磁盘管理(vdo、stratis)的更多相关文章
- RHEL高级磁盘管理—Stratis
		
2. Stratis 本地存储管理工具,通过Stratis可以便捷的使用Thin Provisioning.Snapshots.Pool-based的管理和监控等高级存储功能. Stratis 基于x ...
 - linux磁盘管理系列-LVM的使用
		
LVM是什么 LVM是Linux操作系统的逻辑卷管理器. 现在有两个Linux版本的LVM,分别是 LVM1,LVM2.LVM1是一种已经被认为稳定了几年的成熟产品,LVM2 是最新最好的LVM版本. ...
 - linux 磁盘管理三部曲——(2)管理分区,文件系统类型格式化
		
上篇小编给大家讲解了磁盘结构和分区的介绍,这篇小编就给大家演示如何管理分区和文件系统类型格式化. 小编上篇已经提到如何使用磁盘,今天这两步,就是其中很重要的两步.(前几天写的有点急,有点乱,今天又整理 ...
 - linux磁盘管理系列三:LVM的使用
		
磁盘管理系列 linux磁盘管理系列一:磁盘配额管理 http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html l ...
 - 有关 Azure IaaS VM 磁盘以及托管和非托管高级磁盘的常见问题解答
		
本文将对有关 Azure 托管磁盘和 Azure 高级存储的一些常见问题进行解答. 托管磁盘 什么是 Azure 托管磁盘? 托管磁盘是一种通过处理存储帐户管理来简化 Azure IaaS VM 的磁 ...
 - centos Linux下磁盘管理   parted,df ,du,fdisk,partprobe,mkfs.ext4,mount,/etc/fstab,fsck,e2fsck,mk2efs,tmpfs ,nr_inodes, LVM,传统方式扩容文件系统   第七节课
		
centos Linux下磁盘管理 parted,df ,du,fdisk,partprobe,mkfs.ext4,mount,/etc/fstab,fsck,e2fsck,mk2efs,tmpf ...
 - linux 系统磁盘管理体系
		
目录 linux 系统磁盘管理体系 一.磁盘的基本概念 二.磁盘的内部结构 三.磁盘的外部结构 四.磁盘的接口及类型 五.fdisk磁盘分区实践 六.gdisk 分区 七.parted 高级分区工具. ...
 - Linux上天之路(十)之Linux磁盘管理
		
主要内容 磁盘介绍 磁盘管理 磁盘限额 逻辑卷管理 磁盘阵列 1. 磁盘介绍 硬盘最基本的组成部分是由坚硬金属材料制成的涂以磁性介质的盘片,不同容量硬盘的盘片数不等.每个盘片有两面,都可记录信息.盘片 ...
 - linux下玩转磁盘管理与挂载硬盘
		
前言 本文将带来linux下的磁盘管理中的硬盘挂载,Linux操作系统挂载硬盘需要了解的一些知识.这可能是迄今为止介绍的最最最实用的linux硬盘挂载的文章了,比较详细.由于工作原因,平时使用的比较多 ...
 
随机推荐
- Kubernetes,kubectl常用命令详解
			
kubectl概述 祭出一张图,转载至 kubernetes-handbook/kubectl命令概述 ,可以对命令族有个整体的概念. 环境准备 允许master节点部署pod,使用命令如下: kub ...
 - 机器学习--如何理解Accuracy, Precision, Recall, F1 score
			
当我们在谈论一个模型好坏的时候,我们常常会听到准确率(Accuracy)这个词,我们也会听到"如何才能使模型的Accurcy更高".那么是不是准确率最高的模型就一定是最好的模型? 这篇博文会向大家解释 ...
 - jQuery入门看这一篇就够了
			
一.选择器 1.基本 名称 用法 描述 #id $("#myDiv"); 根据给定的ID匹配一个元素 element $("div"); 根据给定的元素标签名匹 ...
 - 剑指offer刷题
			
1.面试题43. 1-n整数中1出现的次数 输入一个整数 n ,求1-n这n个整数的十进制表示中1出现的次数. 例如,输入12,1-12这些整数中包含1 的数字有1.10.11和12,1一共出现了5次 ...
 - 利用查询条件对象,在Asp.net Web API中实现对业务数据的分页查询处理
			
在Asp.net Web API中,对业务数据的分页查询处理是一个非常常见的接口,我们需要在查询条件对象中,定义好相应业务的查询参数,排序信息,请求记录数和每页大小信息等内容,根据这些查询信息,我们在 ...
 - centos7.4 卸载python2.7.5安装python3.6.3版本
			
CentOS 中默认安装了 2.7的Python,为了使用新版 python,可以对旧版本进行升级.但是由于很多基本的命令.软件包都依赖旧版本,比如:yum等.所以,在更新 Python 时,建议不要 ...
 - mysql 遇到的问题
			
1) 客户端(Navicat)远程登录操作再遇问题1142-create command denied to user×××的解决GRANT SELECT,INSERT,UPDATE,DELETE,C ...
 - 【swagger】 swagger-ui的升级版swagger-bootstrap-ui
			
swagger-bootstrap-ui是基于swagger-ui做了一些优化拓展: swagger-ui的界面: swagger-bootstrap-ui界面: 相比于原生的swagger-ui , ...
 - thinkphp5 ztree树形菜单
			
教程:http://makaidong.com/zjfjava/4074_5873678.html 下载:https://github.com/zTree/zTree_v3
 - hdu1572 水搜索
			
题意: 中文的不解释; 思路: 其实就是一个水的搜索,直接搜索不会超时,还有别跑最短路了,题目没要求跑最短路,别读错题,刚开始自己嘚嗖的跑了一边最短路 wa了 ,正好最近看了STL ...