
我正在嘗試添加空間/dev/mapper/fedora-root
。我可以運行lvextend
並成功添加額外的空間,但它似乎並沒有真正將其添加為可用。
具體來說,我的網站上有 15G 可用空間,用於/var/www/
我需要所有空間的地方。
我在安裝了 fedora-root 的驅動器上有額外的空間,並且在第二個驅動器上還有額外的 2tb 空間可供使用。但每當我添加空間時,它都會保持在 15G。
以下是一些可能有用的命令的輸出:
$ sudo df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 24G 0 24G 0% /dev
tmpfs 24G 8.0K 24G 1% /dev/shm
tmpfs 24G 1.5M 24G 1% /run
/dev/mapper/fedora-root 15G 14G 1.5G 91% /
tmpfs 24G 4.0K 24G 1% /tmp
/dev/sda1 1014M 224M 791M 22% /boot
tmpfs 4.8G 0 4.8G 0% /run/user/1000
tmpfs 4.8G 0 4.8G 0% /run/user/0
$ sudo vgdisplay -v
--- Volume group ---
VG Name fedora
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 12
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 2.08 TiB
PE Size 4.00 MiB
Total PE 546110
Alloc PE / Size 11235 / <43.89 GiB
Free PE / Size 534875 / 2.04 TiB
VG UUID lgfK0B-loTg-wQlS-dtsR-qWZJ-Hqh6-SkWk55
--- Logical volume ---
LV Path /dev/fedora/swap
LV Name swap
VG Name fedora
LV UUID 81zkKH-IeMO-gcoO-O9DX-7w7G-4a1i-lw2dhy
LV Write Access read/write
LV Creation host, time localhost, 2019-11-24 17:33:39 -0500
LV Status available
# open 2
LV Size <23.64 GiB
Current LE 6051
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/fedora/root
LV Name root
VG Name fedora
LV UUID e9fRu0-FupO-8e6V-fodF-ZPQ5-alBK-XVutVM
LV Write Access read/write
LV Creation host, time localhost, 2019-11-24 17:33:40 -0500
LV Status available
# open 1
LV Size 20.25 GiB
Current LE 5184
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Physical volumes ---
PV Name /dev/sda2
PV UUID AdC6bu-ct2C-dP0k-TRM8-PZ7z-vYDj-tN5jGn
PV Status allocatable
Total PE / Free PE 69439 / 58204
PV Name /dev/sdb1
PV UUID n6tBpo-ce7D-MCZR-GFKY-BsHW-pcmG-FmM3Wo
PV Status allocatable
Total PE / Free PE 476671 / 476671
$ sudo lvextend -l+288 /dev/mapper/fedora-root
Size of logical volume fedora/root changed from 20.25 GiB (5184 extents) to <21.38 GiB (5472 extents).
Logical volume fedora/root successfully resized.
$ sudo fdisk -l
Disk /dev/sda: 272.26 GiB, 292326211584 bytes, 570949632 sectors
Disk model: PERC 6/i
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: dos
Disk identifier: 0xdf465195
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 570949631 568850432 271.3G 8e Linux LVM
Disk /dev/sdb: 1.84 TiB, 1999307276288 bytes, 3904897024 sectors
Disk model: PERC 6/i
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: dos
Disk identifier: 0x8e545053
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 3904897023 3904894976 1.8T 8e Linux LVM
Disk /dev/mapper/fedora-root: 21.38 GiB, 22951231488 bytes, 44826624 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/fedora-swap: 23.65 GiB, 25379733504 bytes, 49569792 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
再次運行 'sudo df -h' 得到:
$ sudo df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 24G 0 24G 0% /dev
tmpfs 24G 8.0K 24G 1% /dev/shm
tmpfs 24G 1.5M 24G 1% /run
/dev/mapper/fedora-root 15G 14G 1.5G 91% /
tmpfs 24G 4.0K 24G 1% /tmp
/dev/sda1 1014M 224M 791M 22% /boot
tmpfs 4.8G 0 4.8G 0% /run/user/1000
tmpfs 4.8G 0 4.8G 0% /run/user/0
編輯: $ sudo lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1 xfs 59ff08c1-39e5-4cdd-87a8-d51d7aead2e5 791M 22% /boot
└─sda2 LVM2_member AdC6bu-ct2C-dP0k-TRM8-PZ7z-vYDj-tN5jGn
├─fedora-root xfs cd4163ba-8b53-48db-bd30-32802f4bd3a0 1.4G 91% /
└─fedora-swap swap 2de89191-34eb-4439-81a8-2f879d917821 [SWAP]
sdb
└─sdb1 LVM2_member n6tBpo-ce7D-MCZR-GFKY-BsHW-pcmG-FmM3Wo
答案1
要使空間可用,您需要使用該xfs_growfs
命令,因為邏輯磁碟區上的檔案系統是xfs
。
xfs_growfs /
如果它是 ext2、ext3 或 ext4,那麼您將resize2fs
與該名稱一起使用。
編輯:它似乎在 Fedora 和 RHEL 8 和 CentOS 8 的最新版本中進行了更改。該實用程式的更高版本。