CentOSはlvm拡張を使用
6703 ワード
環境:CentOS 7、パーティションはデフォルトのパーティションを使用します.1台の機械には2 Tのハードディスクが4枚あり、sdaにはシステムがインストールされており、拡張したいと考えています.Webページの内容を参照してください.依然として存在する問題は、vgが6 Tに拡張された後、vlは4 Tに拡張するしかなく、拡張を継続することができず、解決を待つことである.結果!!!意外にもextendを分けてextendを続けることができます!!下記の通りです!!!まるでひざまずいたようだ.だからこの结果の原因は私のこの+后ろの数字が间违っているのです!!!知恵が弱い!
1.現在のlvmの状況を表示(/dev/sda 2)
まず、fdisk-lは、sda、sdb、sdc、sddの4つのハードディスク(HDD)がパーティション化されており、sdbcdはそれぞれ大きな領域に分かれており、sdaにはlvmパーティション/dev/sda 2があります.
コマンドvgdisplayとlvdisplayを使用して、現在のボリュームグループ(Volume group)と論理ボリューム(Logical volumes)の状況を表示します.
lvは、/dev/centos/swap、/dev/centos/home、/dev/centos/rootの3つのlvに分けられます.
2.現在のVGにディスクsdbの容量を追加は、新しいlinux lvm形式のパーティション/dev/sdb 1を作成します./dev/sdbにパーティションがない場合は、先にパーティション化します.私たちの/dev/sdbはすでに/dev/sdb 1のパーティションにパーティション化されているので、lvmパーティションに直接変換できます:fdisk/dev/sdb t#パーティションフォーマット8 e#を変更してLVMパーティションw#に指定してパーティションテーブルpartprobe#を書き込みパーティションテーブル 新しいパーティションにPVを作成し、VGを追加し、LV pvcreate/dev/sdb 1 VG vgextend centos/dev/sdb 1拡張LV lvdisplay lvextend-L xxxxxxx/dev/centos/home(xxxxに増大)または#lvextend-L+xxxxx/dev/centos/home(従来よりxxxxx増加)LVサイズresize 2 fs/dev/centos/homeをリセットファイルシステムがxfsの場合xfs_growfs/dev/centos/home df-h
[root@localhost ~]# lvextend -L +360558 /dev/centos/home
Rounding size to boundary between physical extents: 352.11 GiB
Size of logical volume centos/home changed from 4.03 TiB (1056286 extents) to 4.37 TiB (1146426 extents).
Logical volume home successfully resized.
[root@localhost ~]# lvextend -L +360558 /dev/centos/home
Rounding size to boundary between physical extents: 352.11 GiB
Insufficient free space: 90140 extents needed, but only 90138 available
[root@localhost ~]# lvextend -L +90138 /dev/centos/home
Rounding size to boundary between physical extents: 88.03 GiB
Size of logical volume centos/home changed from 5.06 TiB (1326706 extents) to 5.15 TiB (1349241 extents).
Logical volume home successfully resized.
1.現在のlvmの状況を表示(/dev/sda 2)
まず、fdisk-lは、sda、sdb、sdc、sddの4つのハードディスク(HDD)がパーティション化されており、sdbcdはそれぞれ大きな領域に分かれており、sdaにはlvmパーティション/dev/sda 2があります.
[root@localhost ~]# fdisk -l
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes, 3907029168 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: dos
Disk identifier: 0x0007dc9b
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 3907028991 1953001472 8e Linux LVM
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes, 3907029168 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: dos
Disk identifier: 0xc3897539
Device Boot Start End Blocks Id System
/dev/sdc1 2048 3907029167 1953513560 83 Linux
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes, 3907029168 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: dos
Disk identifier: 0xc3897517
Device Boot Start End Blocks Id System
/dev/sdd1 2048 3907029167 1953513560 83 Linux
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 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: dos
Disk identifier: 0xc389752b
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907029167 1953513560 83 Linux
Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 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/centos-swap: 4294 MB, 4294967296 bytes, 8388608 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/centos-home: 1941.8 GB, 1941824339968 bytes, 3792625664 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
コマンドvgdisplayとlvdisplayを使用して、現在のボリュームグループ(Volume group)と論理ボリューム(Logical volumes)の状況を表示します.
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 1.82 TiB
PE Size 4.00 MiB
Total PE 476806
Alloc PE / Size 476791 / 1.82 TiB
Free PE / Size 15 / 60.00 MiB
VG UUID o56Jrx-kGgK-bfPO-fROL-5UB1-m21V-K3vi9Z
lvは、/dev/centos/swap、/dev/centos/home、/dev/centos/rootの3つのlvに分けられます.
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID H7KpXK-YjfS-ssLE-7gbx-xNnt-QJsQ-hEWcu0
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2016-01-02 20:26:29 +0800
LV Status available
# open 2
LV Size 4.00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID kveGiy-O6Y2-OMqN-2Ec2-76Ls-TdDh-1Rl3uu
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2016-01-02 20:26:29 +0800
LV Status available
# open 1
LV Size 1.77 TiB
Current LE 462967
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID lOLgfM-Jw1f-zH5e-IOld-kVok-Jr0f-IhNfAK
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2016-01-02 20:27:08 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
2.現在のVGにディスクsdbの容量を追加