5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6 でデータボリュームを growpart で拡張する

Posted at

メモ

CloudStack (AWS とかも同様)でディスク容量を拡張した際の手順メモ。
/dev/sdb 10GB → 15GB にリサイズ。

手順

拡張前の状態

# df -h /dev/sdb1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       9.8G   12M  9.3G   1% /data

# lsblk /dev/sdb
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb      8:16   0  10G  0 disk
∟ sdb1   8:17   0  10G  0 part /data

コンソールからディスクサイズ変更(10GB → 15GB)

API でやるときは

$ cs resizeVolume id=10e2655a-3e89-427b-91fb-c84728d4xxxx size=15

growpart インストール

# yum install cloud-utils-growpart

デバイス ID 確認

# lsscsi
[0:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR00 1.00  /dev/sr0
[2:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda
[2:0:1:0]    disk    VMware   Virtual disk     1.0   /dev/sdb

リスキャン

# echo 1 > /sys/class/scsi_disk/2\:0\:1\:0/device/rescan

ディスク容量が増えてるか確認

# lsblk /dev/sdb
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb       8:16   0  15G  0 disk
 ∟ sdb1   8:17   0  10G  0 part /data

パーティション拡張

# growpart /dev/sdb 1
CHANGED: partition=1 start=63 old: size=20964762 end=20964825 new: size=31455207,end=31455270

再起動

# shutdown -r now

ファイルシステム確認

# df -h /dev/sdb1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       9.8G   12M  9.3G   1% /data

ファイルシステム拡張

# resize2fs /dev/sdb1
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/sdb1 is mounted on /data; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/sdb1 to 3931900 (4k) blocks.
The filesystem on /dev/sdb1 is now 3931900 blocks long.

確認

# lsblk /dev/sdb
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb      8:16   0  15G  0 disk
 ∟sdb1   8:17   0  15G  0 part /data

# df -h /dev/sdb1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1        15G   13M   14G   1% /data

OK

5
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?