标签:
[root@ceph-client ~]# rbd showmapped
id pool image snap device
0 rbd foo - /dev/rbd0
[root@ceph-client ~]# rbd info foo
rbd image ‘foo‘:
size 15360 MB in 3840 objects
order 22 (4096 kB objects)
block_name_prefix: rb.0.1026.238e1f29
format: 1
[root@ceph-client ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 29G 3.8G 25G 14% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 88K 2.0G 1% /dev/shm
tmpfs tmpfs 2.0G 8.8M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 497M 106M 392M 22% /boot
/dev/rbd0 ext4 15G 1.1G 13G 8% /mnt
|
[root@ceph-client ~]# rbd resize --size 20480 foo
Resizing image: 100% complete...done.
[root@ceph-client ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 29G 3.8G 25G 14% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 88K 2.0G 1% /dev/shm
tmpfs tmpfs 2.0G 8.8M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 497M 106M 392M 22% /boot
/dev/rbd0 ext4 15G 1.1G 13G 8% /mnt
此时文件系统还未增大
[root@ceph-client ~]# blockdev --getsize64 /dev/rbd0
21474836480
[root@ceph-client ~]# resize2fs /dev/rbd0
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/rbd0 is mounted on /mnt; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
The filesystem on /dev/rbd0 is now 5242880 blocks long.
[root@ceph-client ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 29G 3.8G 25G 14% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 88K 2.0G 1% /dev/shm
tmpfs tmpfs 2.0G 8.8M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 497M 106M 392M 22% /boot
/dev/rbd0 ext4 20G 1.1G 18G 6% /mnt
成功
此方法只对格式化为EXT4文件系统的块设备有效。对于XFS,要在 resize之后执行
# xfs_growfs /mnt
|
1、先关闭虚拟机
2、unmap再map
[root@ceph-client ~]# rbd unmap /dev/rbd0
[root@ceph-client ~]# rbd showmapped
[root@ceph-client ~]# rbd map foo
/dev/rbd0
3、启动虚机
|
标签:
原文地址:http://www.cnblogs.com/tonychiu/p/5766548.html