rbd块设备,镜像大小resize

虚拟镜像的扩展工作在rbd块设备上进行的操作

1 rbd操作
=====================================================

os.system("ssh -o StrictHostKeyChecking=no " + serviceIp + " rbd resize " + image + " --size " + str(size*1024));
2 [root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       13G  1.6G   11G  14% /
tmpfs                 246M     0  246M   0% /dev/shm
/dev/sda1             485M   33M  428M   8% /boot
[root@localhost ~]#

[root@localhost ~]# fdisk -l

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: 0x00053901

   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        1959    15215616   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 13.5 GB, 13463715840 bytes
255 heads, 63 sectors/track, 1636 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/VolGroup-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 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

分区已经扩展,如果使用需要对磁盘进行分区扩展操作
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 qemu-img 操作

os.system("ssh -o StrictHostKeyChecking=no " + serviceIp + "qemu-img resize rbd:" + image  + str(size*1024));



[root@kvm9100 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       13G  1.6G   11G  14% /
tmpfs                 246M     0  246M   0% /dev/shm
/dev/sda1             485M   33M  428M   8% /boot
/dev/sda3             6.9G  144M  6.4G   3% /mnt
[root@kvm9100 ~]# fdisk -l

Disk /dev/sda: 23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 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: 0x00053901

   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        1959    15215616   8e  Linux LVM
/dev/sda3            1959        2871     7332667+  83  Linux

Disk /dev/mapper/VolGroup-lv_root: 13.5 GB, 13463715840 bytes
255 heads, 63 sectors/track, 1636 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/VolGroup-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 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

分区扩展操作后:
[root@localhost mnt]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      12941636   1655468  10628760  14% /
tmpfs                   251308         0    251308   0% /dev/shm
/dev/sda1               495844     32968    437276   8% /boot
/dev/sda3              5153880    141304   4750768   3% /mnt

发表评论

您的电子邮箱地址不会被公开。