메뉴 닫기

openstack cinder extend 후 디스크 리사이즈 적용

현재 디스크 확인


[root@jyh1 ~]# fdisk -l

Disk /dev/vda: 26.8 GB, 26843545600 bytes, 52428800 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: 0x000871cb

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    52428799    26213376   83  Linux

Disk /dev/vdb: 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 label type: dos
Disk identifier: 0x1cce4b61

 Device Boot Start End Blocks Id System
/dev/vdb1 2048 10485759 5241856 83 Linux

[root@jyh1 ~]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/vda1      ext4       25G  1.2G   23G   5% /
devtmpfs       devtmpfs  488M     0  488M   0% /dev
tmpfs          tmpfs     497M     0  497M   0% /dev/shm
tmpfs          tmpfs     497M   13M  484M   3% /run
tmpfs          tmpfs     497M     0  497M   0% /sys/fs/cgroup
tmpfs          tmpfs     100M     0  100M   0% /run/user/0
/dev/vdb1      ext4      4.8G   20M  4.6G   1% /mnt

mount 해제후 컨트롤러에서 디스크 detach후 확장


[root@jyh1 ~]# umount /mnt

root@con-jyh:~# nova volume-detach jyh1 d79e13e0-128d-496d-b752-9b8db48c1e1a

root@con-jyh:~# cinder extend d79e13e0-128d-496d-b752-9b8db48c1e1a 10

root@con-jyh:~# nova volume-attach jyh1 d79e13e0-128d-496d-b752-9b8db48c1e1a
+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdb                             |
| id       | d79e13e0-128d-496d-b752-9b8db48c1e1a |
| serverId | 5a5aaa5a-e814-4ed7-bd4c-493374a84af5 |
| volumeId | d79e13e0-128d-496d-b752-9b8db48c1e1a |
+----------+--------------------------------------+

fdisk로 디스크 확장(디스크 나누지 않고 통으로 쓸경우 건너 뛴다. ex) vdb, vdc)


[root@jyh1 ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x1cce4b61

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048    10485759     5241856   83  Linux

Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):         -> 파티션이 1개임으로 엔터 입력
First sector (2048-20971519, default 2048):     -> 시작되는 섹터 2048 이며 엔터 입력
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):    -> 마지막 섹터 20971519 이며 엔터 입력
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x1cce4b61

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048    20971519    10484736   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

mount 후 resize


[root@jyh1 ~]# mount /dev/vdb1 /mnt

[root@jyh1 ~]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/vda1      ext4       25G  1.2G   23G   5% /
devtmpfs       devtmpfs  488M     0  488M   0% /dev
tmpfs          tmpfs     497M     0  497M   0% /dev/shm
tmpfs          tmpfs     497M   13M  484M   3% /run
tmpfs          tmpfs     497M     0  497M   0% /sys/fs/cgroup
tmpfs          tmpfs     100M     0  100M   0% /run/user/0
/dev/vdb1      ext4      4.8G   20M  4.6G   1% /mnt
-> 리사이즈 전이기에 5G로 출력 된다.

[root@jyh1 ~]# resize2fs /dev/vdb1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vdb1 is mounted on /mnt; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/vdb1 is now 2621184 blocks long.

[root@jyh1 ~]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/vda1      ext4       25G  1.2G   23G   5% /
devtmpfs       devtmpfs  488M     0  488M   0% /dev
tmpfs          tmpfs     497M     0  497M   0% /dev/shm
tmpfs          tmpfs     497M   13M  484M   3% /run
tmpfs          tmpfs     497M     0  497M   0% /sys/fs/cgroup
tmpfs          tmpfs     100M     0  100M   0% /run/user/0
/dev/vdb1      ext4      9.8G   23M  9.3G   1% /mnt

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x