diff --git a/source/_posts/Linux.md b/source/_posts/Linux.md index 4c6e4e9..0c8a25e 100644 --- a/source/_posts/Linux.md +++ b/source/_posts/Linux.md @@ -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) diff --git a/source/_posts/Linux/image-20240201162619794.png b/source/_posts/Linux/image-20240201162619794.png new file mode 100644 index 0000000..4fb50b1 Binary files /dev/null and b/source/_posts/Linux/image-20240201162619794.png differ diff --git a/source/_posts/Linux/image-20240201162720183.png b/source/_posts/Linux/image-20240201162720183.png new file mode 100644 index 0000000..100b76e Binary files /dev/null and b/source/_posts/Linux/image-20240201162720183.png differ diff --git a/source/_posts/Linux/image-20240201162906958.png b/source/_posts/Linux/image-20240201162906958.png new file mode 100644 index 0000000..c144948 Binary files /dev/null and b/source/_posts/Linux/image-20240201162906958.png differ diff --git a/source/_posts/Linux/image-20240201163026019.png b/source/_posts/Linux/image-20240201163026019.png new file mode 100644 index 0000000..75a6f59 Binary files /dev/null and b/source/_posts/Linux/image-20240201163026019.png differ diff --git a/source/_posts/Linux/image-20240201163052988.png b/source/_posts/Linux/image-20240201163052988.png new file mode 100644 index 0000000..b7f9c95 Binary files /dev/null and b/source/_posts/Linux/image-20240201163052988.png differ diff --git a/source/_posts/Linux/image-20240201163211759.png b/source/_posts/Linux/image-20240201163211759.png new file mode 100644 index 0000000..65c1522 Binary files /dev/null and b/source/_posts/Linux/image-20240201163211759.png differ diff --git a/source/_posts/Linux/image-20240201163229297.png b/source/_posts/Linux/image-20240201163229297.png new file mode 100644 index 0000000..b794dd8 Binary files /dev/null and b/source/_posts/Linux/image-20240201163229297.png differ diff --git a/source/_posts/Linux/image-20240201163300368.png b/source/_posts/Linux/image-20240201163300368.png new file mode 100644 index 0000000..5c5af6d Binary files /dev/null and b/source/_posts/Linux/image-20240201163300368.png differ diff --git a/source/_posts/Linux/image-20240201163342757.png b/source/_posts/Linux/image-20240201163342757.png new file mode 100644 index 0000000..f03d22a Binary files /dev/null and b/source/_posts/Linux/image-20240201163342757.png differ diff --git a/source/_posts/Linux/image-20240201163506115.png b/source/_posts/Linux/image-20240201163506115.png new file mode 100644 index 0000000..89323c7 Binary files /dev/null and b/source/_posts/Linux/image-20240201163506115.png differ diff --git a/source/_posts/Linux/image-20240201163544310.png b/source/_posts/Linux/image-20240201163544310.png new file mode 100644 index 0000000..58167b7 Binary files /dev/null and b/source/_posts/Linux/image-20240201163544310.png differ diff --git a/source/_posts/Linux/image-20240201163800217.png b/source/_posts/Linux/image-20240201163800217.png new file mode 100644 index 0000000..734dc5c Binary files /dev/null and b/source/_posts/Linux/image-20240201163800217.png differ diff --git a/source/_posts/Linux/image-20240201163826924.png b/source/_posts/Linux/image-20240201163826924.png new file mode 100644 index 0000000..4d1dc83 Binary files /dev/null and b/source/_posts/Linux/image-20240201163826924.png differ diff --git a/source/_posts/Linux/image-20240201163847295.png b/source/_posts/Linux/image-20240201163847295.png new file mode 100644 index 0000000..31163a2 Binary files /dev/null and b/source/_posts/Linux/image-20240201163847295.png differ