可以在 Centos 機器上擴充 /DEV/SDB1 而不會造成停機/資料遺失嗎?

可以在 Centos 機器上擴充 /DEV/SDB1 而不會造成停機/資料遺失嗎?

在 CentOS6 上,我想擴展 /dev/sdb1 以獲得更多可用空間:

df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_www-lv_root 18G 2.9G 14G 18% / tmpfs 3.9G 0 3.9G 0% /dev/shm /dev/sda1 477M 105M 347M 24% /boot /dev/sdb1 296G 233G 48G 84% /sqldata

VMWare中實體硬碟SDB已經擴展到600GB。 Fdisk /dev/sdb1 如下:

Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000021cd

Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 2611 20458496 8e Linux LVM

Disk /dev/sdb: 644.2 GB, 644245094400 bytes 255 heads, 63 sectors/track, 78325 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x07acc91f

Device Boot Start End Blocks Id System /dev/sdb1 1 39162 314568733+ 83 Linux /dev/sdb2 39163 78325 314576797+ 8e Linux LVM

Disk /dev/mapper/vg_www-lv_root: 18.9 GB, 18865979392 bytes 255 heads, 63 sectors/track, 2293 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

Disk /dev/mapper/vg_www-lv_swap: 2080 MB, 2080374784 bytes 255 heads, 63 sectors/track, 252 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

您可能會看到,/dev/sdb1 不是磁碟區組的一部份。所以我不知道如何繼續。

我已經建立了一個新分割區:/dev/sdb2 作為 linux LVM: fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').

Command (m for help): p

Disk /dev/sdb: 644.2 GB, 644245094400 bytes 255 heads, 63 sectors/track, 78325 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x07acc91f

Device Boot Start End Blocks Id System /dev/sdb1 1 39162 314568733+ 83 Linux /dev/sdb2 39163 78325 314576797+ 8e Linux LVM

/dev/sdb2 是一個新的(空)分割區,包含新的 300GB 磁碟空間。因為我真的無法承受任何停機時間,所以我想知道如何「合併」sdb1 和 sdb2,所以我最終得到了大約 600gb 的 /sqldata。

謝謝!

答案1

在這種環境下,單一分區很可能需要停機。

EL6 文件警告您不嘗試在正在使用的裝置上調整大小。停止使用此檔案系統的所有操作,卸載它,並更改其分割表。

EL7 品牌可以在線上調整分割區大小,透過刪除、重新建立、以及partx --update告訴核心的技巧。您需要先升級,可能升級到 EL8。


使用 LVM 而不是分割區,這會更容易。完全跳過分區。在整個裝置上建立實體卷,例如/dev/sdb.調整磁碟大小,然後使用它來調整 PV pvresize。由於您沒有使用 LVM,因此這將遷移到新的 LVM 儲存體。

相關內容