ceph RBD 在线扩容

要求linux 内核3.8以上

在线改变已经挂载的ceph 块设备容量:

# rbd create --size 10000 test
# rbd map test
# mkfs.ext4 -q /dev/rbd1
# mount /dev/rbd1 /mnt
# df -h /mnt
Filesystem      Size  Used Avail Use% Mounted on
/dev/rbd1       9.5G   22M  9.0G   1% /mnt
# blockdev --getsize64 /dev/rbd1
10485760000
# rbd resize --size 20000 test
Resizing image: 100% complete...done.
# blockdev --getsize64 /dev/rbd1
20971520000
# resize2fs /dev/rbd1
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/rbd1 is mounted on /mnt; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/rbd1 is now 5120000 blocks long.
# df -h /mnt
Filesystem      Size  Used Avail Use% Mounted on
/dev/rbd1        20G   27M   19G   1% /mnt


此方法只对格式化未EXT4文件系统的块设备有效。对于XFS,要再 resize之后执行

# xfs_growfs /mnt

文章翻译自:http://dachary.org/?p=2179&utm_source=tuicool

你可能感兴趣的:(ceph RBD 在线扩容)