Partition

在 Opensuse 中調整 /home 的大小

  • January 10, 2019

我正在使用Opensuse Tumbleweed並將root partitionasbtrfshome分區設置為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

要在擴展 LV 後擴展文件系統,您應該執行命令

resize2fs /dev/mapper/system-home 

通常這可以即時完成(無需解除安裝文件系統)

引用自:https://unix.stackexchange.com/questions/493690