![在 Arch Linux 上调整逻辑卷大小的正确过程是什么](https://linux22.com/image/224178/%E5%9C%A8%20Arch%20Linux%20%E4%B8%8A%E8%B0%83%E6%95%B4%E9%80%BB%E8%BE%91%E5%8D%B7%E5%A4%A7%E5%B0%8F%E7%9A%84%E6%AD%A3%E7%A1%AE%E8%BF%87%E7%A8%8B%E6%98%AF%E4%BB%80%E4%B9%88.png)
我在笔记本电脑上使用 Arch Linux 发行版,几天前我使用命令运行了更新sudo pacman -Syu
。更新执行成功;但是,我收到以下错误,
the volume Filesystem root has only 1.0GB disk space
我运行了该命令df -h
并收到了此输出。
Filesystem Size Used Avail Use% Mounted on
dev 7.7G 0 7.7G 0% /dev
run 7.7G 2.1M 7.7G 1% /run
/dev/mapper/volgroup0-lv_root 30G 27G 1.4G 96% /
tmpfs 7.7G 41M 7.7G 1% /dev/shm
tmpfs 7.7G 4.3M 7.7G 1% /tmp
/dev/nvme0n1p2 459M 157M 273M 37% /boot
/dev/mapper/volgroup0-lv_home 908G 63G 799G 8% /home
tmpfs 1.6G 104K 1.6G 1% /run/user/1000
我也运行df -i
并收到了这个输出。
Filesystem Inodes IUsed IFree IUse% Mounted on
dev 2004803 790 2004013 1% /dev
run 2010868 1373 2009495 1% /run
/dev/mapper/volgroup0-lv_root 1966080 433229 1532851 23% /
tmpfs 2010868 105 2010763 1% /dev/shm
tmpfs 1048576 58 1048518 1% /tmp
/dev/nvme0n1p2 128016 379 127637 1% /boot
/dev/mapper/volgroup0-lv_home 60481536 340313 60141223 1% /home
tmpfs 402173 148 402025 1% /run/user/1000
我曾考虑过重新安装所有内容并为root
目录提供 100GB 空间而不是 30GB;然而,重新安装所有内容的过程将需要几天的时间。相反,我认为最好将内存从一个home
卷重新分配到另一个root
卷。我必须承认我没有太多重新分配内存的经验。在执行我认为正确的命令之前,我想向可能不比我更好的观众展示我所知道的过程。下面我将我的流程列出来,如果您认为是正确的,或者哪里有缺陷,请告诉我。
1. Backup all data
2. Flash a thumb drive with the most current version of Arch Linux
3. Boot from the thumb drive in live mode
4. Unmount volumes
umount /dev/mapper/volgroup0-lv_home
umount /dev/mapper/volgroup0-lv_root
5. Check for filesystem errors
e2fsck -f /dev/mapper/volgroup0-lv_home
e2fsck -f /dev/mapper/volgroup0-lv_root
6. Shrink the home Filesystem from 799 to 700 GB
resize2fs /dev/mapper/volgroup0-lv_home 700G
7. Reduce the lb_home logical volume
lvreduce -L 700G /dev/mapper/volgroup0-lv_home
8. Extend the lv_root logical volume
lvextend -l +100%FREE /dev/mapper/volgroup0-lv_root
9. Extend the / filesystem
resize2fs /dev/mapper/volgroup0-lv_root
10. Re-mount volumes
mount /dev/mapper/volgroup0-lv_home /home
mount /dev/mapper/volgroup0-lv_root /
11. Verify file systems
df -h