系统相关
首页 > 系统相关> > LinuxProbe 笔记 第九课

LinuxProbe 笔记 第九课

作者:互联网

LinuxProbe 笔记 第九课 【20210423】
6.8 VDO虚拟数据优化
挂载redhat8镜像盘
[root@localhost mnt]# mkdir redhat8
[root@localhost mnt]# mount /dev/cdrom /mnt/redhat8/
[root@localhost mnt]# ls /mnt/redhat8/

配置yum源
[root@localhost redhat8]# vim /etc/yum.repos.d/redhat.repo
[baseos]
name=baseos
baseurl=file:///mnt/redhat8/BaseOS
enabled=1
gpgcheck=0

[APP]
name=APP
baseurl=file:///mnt/redhat8/AppStream
enabled=1
gpgcheck=0
~
按照VDO
[root@localhost redhat8]# dnf install kmod-kvdo vdo
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
APP 44 MB/s | 5.3 MB 00:00
baseos 16 MB/s | 2.2 MB 00:00
Last metadata expiration check: 0:00:01 ago on Mon 26 Apr 2021 04:32:35 PM EDT.
Package kmod-kvdo-6.2.0.293-50.el8.x86_64 is already installed.
Package vdo-6.2.0.293-10.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

-------------------------------------------------
vdo实验 (实际空间的十倍)
[root@localhost redhat8]# vdo create --name=storgage --device=/dev/sdc --vdoLogicalSize=200G
Creating VDO storgage
Starting VDO storgage
Starting compression on VDO storgage
VDO instance 0 volume is ready at /dev/mapper/storgage

[root@localhost ~]# vdo status --name=storage
VDO status:
Date: '2021-04-26 17:13:19-04:00'
Node: localhost.localdomain
Kernel module:
Loaded: true
Name: kvdo
Version information:
kvdo version: 6.2.0.293
Configuration:
File: /etc/vdoconf.yml
Last modified: '2021-04-26 17:13:02'
VDOs:
storage:
Acknowledgement threads: 1

[root@localhost ~]# mkfs.xfs /dev/mapper/storage
meta-data=/dev/mapper/storage isize=512 agcount=4, agsize=3276800 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=6400, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# udevadm settle
[root@localhost ~]# mkdir /storage
[root@localhost ~]# mount /dev/mapper/storage /storage

[root@localhost ~]# blkid /dev/mapper/storage
/dev/mapper/storage: UUID="a801a69b-681c-43ec-bf59-b6ad8d80f890" TYPE="xfs"
[root@localhost ~]# vim /etc/fstab
#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=7e3851e0-2b41-45d5-bd50-085d9a1acd83 /boot xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
UUID=a801a69b-681c-43ec-bf59-b6ad8d80f890 /storage xfs defaults 0 0


[root@localhost mnt]# ls -lh /mnt/redhat8/images/install.img
-r--r--r--. 1 root root 448M Apr 4 2019 /mnt/redhat8/images/install.img
[root@localhost mnt]# cp /mnt/redhat8/images/install.img /storage/
[root@localhost mnt]# ls -lh /storage/
total 448M
-r--r--r--. 1 root root 448M Apr 26 17:24 install.img
[root@localhost mnt]# vdostats --human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/storage 5.0G 3.4G 1.6G 68% 5%
[root@localhost mnt]# cp /mnt/redhat8/images/install.img /storage/bin.img
[root@localhost mnt]# ls -lh /storage/
total 896M
-r--r--r--. 1 root root 448M Apr 26 17:27 bin.img
-r--r--r--. 1 root root 448M Apr 26 17:24 install.img
[root@localhost mnt]# vdostats --human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/storage 5.0G 3.4G 1.6G 68% 51%

----------------------------------
6.9 软硬方式链接

ln命令用于创建文件的软硬链接,英文全称为:“link”,语法格式为:“ln [参数] 原始文件名 链接文件名”
表6-8 ln命令中可用的参数以及作用
参数 作用
-s 创建“符号链接”(如果不带-s参数,则默认创建硬链接)
-f 强制创建文件或目录的链接
-i 覆盖前先询问
-v 显示创建链接的过程

软链接
[root@localhost ~]# echo "Welcome to ruanlianjie" > rlj.txt
[root@localhost ~]# ls
anaconda-ks.cfg Documents initial-setup-ks.cfg Pictures rlj.txt Videos
Desktop Downloads Music Public Templates
[root@localhost ~]# cat rlj.txt
Welcome to ruanlianjie
[root@localhost ~]# ln -s rlj.txt rlj2.txt
[root@localhost ~]# ls
anaconda-ks.cfg Documents initial-setup-ks.cfg Pictures rlj2.txt Templates
Desktop Downloads Music Public rlj.txt Videos
[root@localhost ~]# cat rlj
rlj2.txt rlj.txt
[root@localhost ~]# cat rlj.txt
Welcome to ruanlianjie
[root@localhost ~]# cat rlj2.txt
Welcome to ruanlianjie

删掉原始文件后,软链接就无法读取
[root@localhost ~]# rm -f rlj.txt
[root@localhost ~]# cat rlj2.txt
cat: rlj2.txt: No such file or directory
------------------------
硬链接
[root@localhost ~]# echo "Welcome to yinlianjie" > ylj.txt
[root@localhost ~]# ln ylj.txt ylj2.txt
[root@localhost ~]# ls
anaconda-ks.cfg Documents initial-setup-ks.cfg Pictures rlj2.txt Videos ylj.txt
Desktop Downloads Music Public Templates ylj2.txt
[root@localhost ~]# cat ylj.txt
Welcome to yinlianjie
[root@localhost ~]# cat ylj2.txt
Welcome to yinlianjie
[root@localhost ~]# ls -l ylj.txt
-rw-r--r--. 2 root root 22 Apr 27 16:41 ylj.txt

删掉原始文件后,硬链接还能读取
[root@localhost ~]# rm -f ylj.txt
[root@localhost ~]# cat ylj2.txt
Welcome to yinlianjie
[root@localhost ~]# ls -l ylj2.txt
-rw-r--r--. 1 root root 22 Apr 27 16:41 ylj2.txt

 

标签:LinuxProbe,--,storage,mnt,笔记,第九课,txt,root,localhost
来源: https://www.cnblogs.com/bing2215/p/14710841.html