我正在使用Opensuse Tumbleweed
并设置root partition
asbtrfs
和home
分区 as ext4
。我lvm
在安装时使用。安装时,根分区有40GB,主分区有25GB分配空间。大约有 300GB 未分配。现在,由于 中的空间不足/home
,我将其大小Linux LVM partition
从 75GB 调整为 187.9GB。我还扩展了 lvm 分区,lvextend -L+20GB /dev/system/home
我认为使用它可以为我的主分区添加额外的 20GB。输出fdisk -l
显示分区大小已调整如下:
Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Micron_1100_MTFD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 04174A0E-F3C6-459F-A2AB-93E3BED5D4D7
Device Start End Sectors Size Type
/dev/sda1 411648 394334207 393922560 187.9G Linux LVM
/dev/sda4 2048 411647 409600 200M BIOS boot
Partition table entries are not in disk order.
Disk /dev/mapper/system-root: 40 GiB, 42949672960 bytes, 83886080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/system-swap: 7.7 GiB, 8246001664 bytes, 16105472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/system-home: 45 GiB, 48318382080 bytes, 94371840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes/
I/O size (minimum/optimal): 512 bytes / 512 bytes
输出df -h
显示/home
目录保持相同的大小,如下所示:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 57M 3.8G 2% /dev/shm
tmpfs 3.9G 1.7M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/system-root 40G 14G 27G 34% /
/dev/mapper/system-root 40G 14G 27G 34% /boot/grub2/i386-pc
/dev/mapper/system-root 40G 14G 27G 34% /.snapshots
/dev/mapper/system-root 40G 14G 27G 34% /boot/grub2/x86_64-efi
/dev/mapper/system-root 40G 14G 27G 34% /srv
/dev/mapper/system-root 40G 14G 27G 34% /var
/dev/mapper/system-root 40G 14G 27G 34% /tmp
/dev/mapper/system-root 40G 14G 27G 34% /usr/local
/dev/mapper/system-root 40G 14G 27G 34% /opt
/dev/mapper/system-home 25G 22G 1.7G 94% /home
tmpfs 786M 16K 786M 1% /run/user/1000
调整分区大小时我错过了哪些步骤?为什么更改的大小不会影响/home
目录?
谢谢
编辑
根据要求,输出lsblk -f /dev/mapper/system-home
:
NAME FSTYPE LABEL UUID FSAVAIL
FSUSE% MOUNTPOINT
system-home ext4 9315a4b3-2dde-41ad-8937-20c492304639 1.6G 88% /home
答案1
要在扩展 LV 后扩展文件系统,您应该执行命令
resize2fs /dev/mapper/system-home
通常这可以即时完成(不需要卸载文件系统)