提交
@ -810,6 +810,135 @@ du -sh /*
|
|||||||
|
|
||||||
### LVM
|
### LVM
|
||||||
|
|
||||||
|
#### 旧有卷
|
||||||
|
|
||||||
|
将 `/home`部分空间合并至`/`下
|
||||||
|
|
||||||
|
```shell
|
||||||
|
df -h
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
查看卷的文件系统类型
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mount |grep home
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
安装`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
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
移除 `/dev/mapper/almalinux-home`(删除前请确保重要文件已备份)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
lvremove /dev/mapper/almalinux-home
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```shell
|
||||||
|
lsblk
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
扩展`/dev/mapper/almalinux-root`增加8.7G
|
||||||
|
|
||||||
|
```shell
|
||||||
|
lvresize -L +8.7G /dev/mapper/almalinux-root
|
||||||
|
lsblk
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```shell
|
||||||
|
df -h
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
扩展文件系统根目录
|
||||||
|
|
||||||
|
```shell
|
||||||
|
xfs_growfs /
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```shell
|
||||||
|
df -h
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
重新创建`/dev/mapper/almalinux-home`
|
||||||
|
|
||||||
|
```shell
|
||||||
|
lvcreate -L 9G -n home almalinux
|
||||||
|
lsblk
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
将剩余空闲空间扩展给`/dev/mapper/almalinux-home`
|
||||||
|
|
||||||
|
```shell
|
||||||
|
lvextend -l +100%FREE -n /dev/mapper/almalinux-home
|
||||||
|
lsblk
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
格式化`/dev/mapper/almalinux-home`
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mkfs.xfs /dev/mapper/almalinux-home
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
挂载
|
||||||
|
|
||||||
|
**因为lv名称和挂载点不变,因此无需修改/etc/fstab**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mount -a
|
||||||
|
df -Th
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
还原
|
||||||
|
|
||||||
|
```shell
|
||||||
|
xfsrestore -f sdb_dump /home/
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### 新加卷
|
||||||
|
|
||||||
Orale VirtualBox
|
Orale VirtualBox
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
BIN
source/_posts/Linux/image-20240201162619794.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
source/_posts/Linux/image-20240201162720183.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
source/_posts/Linux/image-20240201162906958.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
source/_posts/Linux/image-20240201163026019.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
source/_posts/Linux/image-20240201163052988.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
source/_posts/Linux/image-20240201163211759.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
source/_posts/Linux/image-20240201163229297.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
source/_posts/Linux/image-20240201163300368.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
source/_posts/Linux/image-20240201163342757.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
source/_posts/Linux/image-20240201163506115.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
source/_posts/Linux/image-20240201163544310.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
source/_posts/Linux/image-20240201163800217.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
source/_posts/Linux/image-20240201163826924.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
source/_posts/Linux/image-20240201163847295.png
Normal file
|
After Width: | Height: | Size: 22 KiB |