This commit is contained in:
YUN-PC5\user 2024-02-18 17:18:48 +08:00
parent 2c19d4132c
commit 387cc8f279
15 changed files with 129 additions and 0 deletions

View File

@ -810,6 +810,135 @@ du -sh /*
### LVM
#### 旧有卷
`/home`部分空间合并至`/`
```shell
df -h
```
![image-20240201162619794](Linux/image-20240201162619794.png)
查看卷的文件系统类型
```shell
mount |grep home
```
![image-20240201162720183](Linux/image-20240201162720183.png)
安装`xfsdump`备份工具
```shell
dnf install -y xfsdump
```
备份`/home`
```shell
xfsdump -f ~/sdb_dump/ /home -M sdb_home -L sdb_home_1
```
卸载`/home`
```shell
umount /home/
df -h
```
![image-20240201162906958](Linux/image-20240201162906958.png)
移除 `/dev/mapper/almalinux-home`(删除前请确保重要文件已备份)
```shell
lvremove /dev/mapper/almalinux-home
```
![image-20240201163026019](Linux/image-20240201163026019.png)
```shell
lsblk
```
![image-20240201163052988](Linux/image-20240201163052988.png)
扩展`/dev/mapper/almalinux-root`增加8.7G
```shell
lvresize -L +8.7G /dev/mapper/almalinux-root
lsblk
```
![image-20240201163211759](Linux/image-20240201163211759.png)
```shell
df -h
```
![image-20240201163229297](Linux/image-20240201163229297.png)
扩展文件系统根目录
```shell
xfs_growfs /
```
![image-20240201163300368](Linux/image-20240201163300368.png)
```shell
df -h
```
![image-20240201163342757](Linux/image-20240201163342757.png)
重新创建`/dev/mapper/almalinux-home`
```shell
lvcreate -L 9G -n home almalinux
lsblk
```
![image-20240201163506115](Linux/image-20240201163506115.png)
将剩余空闲空间扩展给`/dev/mapper/almalinux-home`
```shell
lvextend -l +100%FREE -n /dev/mapper/almalinux-home
lsblk
```
![image-20240201163544310](Linux/image-20240201163544310.png)
格式化`/dev/mapper/almalinux-home`
```shell
mkfs.xfs /dev/mapper/almalinux-home
```
![image-20240201163800217](Linux/image-20240201163800217.png)
挂载
**因为lv名称和挂载点不变因此无需修改/etc/fstab**
```shell
mount -a
df -Th
```
![image-20240201163826924](Linux/image-20240201163826924.png)
还原
```shell
xfsrestore -f sdb_dump /home/
```
![image-20240201163847295](Linux/image-20240201163847295.png)
#### 新加卷
Orale VirtualBox
![image-20240130093530200](Linux/image-20240130093530200.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB