
我在分配給伺服器的一些空間時遇到問題,我需要向分割區 /store 新增 1TB
df -h 顯示
[root@SERVER ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 12G 0 12G 0% /dev
tmpfs 12G 56K 12G 1% /dev/shm
tmpfs 12G 26M 12G 1% /run
tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/mapper/rootrhel-root 13G 3.5G 9.1G 28% /
/dev/mapper/rootrhel-opt 13G 6.6G 6.0G 53% /opt
/dev/mapper/rootrhel-storetmp 15G 34M 15G 1% /storetmp
/dev/mapper/storerhel-store 2.9T 2.6T 350G 89% /store
/dev/sda3 32G 5.5G 27G 18% /recovery
/dev/mapper/rootrhel-tmp 3.0G 46M 3.0G 2% /tmp
/dev/mapper/rootrhel-var 5.0G 253M 4.8G 5% /var
/dev/mapper/rootrhel-varlog 15G 1.3G 14G 9% /var/log
/dev/mapper/rootrhel-varlogaudit 3.0G 84M 3.0G 3% /var/log/audit
/dev/mapper/rootrhel-home 1014M 33M 982M 4% /home
/dev/sda2 1014M 358M 657M 36% /boot
/dev/sda1 200M 9.9M 190M 5% /boot/efi
tmpfs 2.4G 0 2.4G 0% /run/user/0
和 fdisk -l 顯示
[root@SERVER ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 4398.0 GB, 4398046511104 bytes, 8589934592 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 label type: gpt
Disk identifier: 56EB4CE6-541B-4A54-BE1C-5F2738DEDEA4
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 2508799 1G Microsoft basic
3 2508800 69617663 32G Microsoft basic
4 69617664 6264891391 2.9T Linux LVM
5 6264891392 6405408767 67G Linux LVM
6 6405408768 6442438655 17.7G Linux swap
7 6442438656 6442450910 6M Linux filesyste
Disk /dev/mapper/rootrhel-root: 13.4 GB, 13421772800 bytes, 26214400 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/rootrhel-storetmp: 16.1 GB, 16106127360 bytes, 31457280 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/rootrhel-tmp: 3221 MB, 3221225472 bytes, 6291456 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/rootrhel-home: 1073 MB, 1073741824 bytes, 2097152 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/rootrhel-opt: 13.4 GB, 13421772800 bytes, 26214400 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/rootrhel-varlogaudit: 3221 MB, 3221225472 bytes, 6291456 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/rootrhel-varlog: 16.1 GB, 16106127360 bytes, 31457280 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/rootrhel-var: 5368 MB, 5368709120 bytes, 10485760 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/storerhel-store: 3172.0 GB, 3171980148736 bytes, 6195273728 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
這是我使用parted然後列印free看到的
[root@SERVER ~]# parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 211MB 210MB fat16 EFI System Partition boot
2 211MB 1285MB 1074MB xfs
3 1285MB 35.6GB 34.4GB xfs
4 35.6GB 3208GB 3172GB lvm
5 3208GB 3280GB 71.9GB lvm
6 3280GB 3299GB 19.0GB linux-swap(v1)
7 3299GB 3299GB 6275kB
3299GB 4398GB 1100GB Free Space
(parted)
所以 1TB 未分配,但我找不到在哪裡調整分割區大小
我嘗試使用 resize2fs、xfs_growfs、fdisk、parted 但沒有任何反應
有什麼可能的解決辦法嗎?謝謝
答案1
這裡仍然有一些猜測,但是...
看起來分割區 7、6 MB 檔案系統未使用。如果這是正確的,我會刪除它並建立一個新分割區。理想情況下,您可以將現有分割區 5 和 6 移至磁碟末尾,以便可以使用pvresize
目前分割區store
,但我沒有為您提供命令列演練。
如果您能夠使用rescue-cd並且可以承受伺服器上的停機時間,您可以啟動rescue-cd並使用gparted
圖形化前端來移動它們(命令列工具放棄了對移動一段時間的支援)前)。
如果無法選擇停機,最簡單的方法是在可用空間中建立新分割區,並將其新增至現有磁碟區組。假設您刪除了微小的 #7,並用 1TB 重新建立了它。 (如果正在使用,請建立一個新分割區 #8 並在下面的範例中使用它)。
vgextend storerhel-store /dev/sda7
現在, Avgdisplay
應顯示卷組的可用盤區大小為 1TB(空閒 PE)。之後你可以
lvextend -r -l +<Available Size> /dev/mapper/storerhel-store