当前位置:网站首页>RBD块存储设备的扩容以及缩容操作(六)
RBD块存储设备的扩容以及缩容操作(六)
2022-07-28 02:32:00 【Jiangxl~】
RBD块存储设备的扩容以及缩容操作
文章目录
RBD块存储在使用过程中,肯定会遇到磁盘空间不够用的情况,需要进行扩容,也会遇到磁盘空间太大,这时就需要缩容。
1.RBD块存储设备的扩容操作
当前RBD块存储设备的空间为10GB,下面将它扩容到20GB。

1.1.对RBD底层块存储设备进行扩容
从10GB扩容到20GB。
[[email protected] ~]# rbd resize -p ceph-rbd-data --image rbd-data.img --size 20G
Resizing image: 100% complete...done.
查看块设备是否扩容成功。
[[email protected] ~]# rbd -p ceph-rbd-data --image rbd-data.img info
rbd image 'rbd-data.img':
size 20 GiB in 5120 objects
order 22 (4 MiB objects)
snapshot_count: 0
id: 1275a517470
block_name_prefix: rbd_data.1275a517470
format: 2
features: layering
op_features:
flags:
create_timestamp: Fri Apr 1 17:23:38 2022
access_timestamp: Fri Apr 1 17:23:38 2022
modify_timestamp: Fri Apr 1 17:23:38 2022
块设备成功扩容到了20GB,并且Object对象文件的数量也随之进行了增加。
1.2.扩容块存储设备映射的磁盘设备
RBD块存储已经扩容成功,但是映射出的磁盘空间还是10G,下面需要对磁盘的空间进行扩容。
1.如果是xfs类型的文件系统则执行下面命令进行扩容
[[email protected] ~]# xfs_growfs /dev/rbd0
2.如果是ext4类型的文件系统则执行下面命令进行扩容
[[email protected] ~]# resize2fs /dev/rbd0
此时磁盘的空间已经扩容成20G。

2.RBD块存储设备的缩容操作
当前RBD块存储设备的空间为20GB,下面将它缩容到10GB。
2.1.对RBD底层块存储设备进行缩容
命令与扩容基本一样,只不过多了一个--allow-shrink参数,表示缩容,--size参数表示缩容的大小。
缩容的过程比较慢,并且可能会导致数据丢失,一般不建议缩容。
[[email protected] ~]# rbd resize -p ceph-rbd-data --image rbd-data.img --allow-shrink --size 10G
Resizing image: 100% complete...done.
块存储设备缩容成功,已经缩减成了10G容量,Object对象文件的数量也进行了缩减。
[[email protected] ~]# rbd -p ceph-rbd-data --image rbd-data.img info
rbd image 'rbd-data.img':
size 10 GiB in 2560 objects
order 22 (4 MiB objects)
snapshot_count: 0
id: 1275a517470
block_name_prefix: rbd_data.1275a517470
format: 2
features: layering
op_features:
flags:
create_timestamp: Fri Apr 1 17:23:38 2022
access_timestamp: Fri Apr 1 17:23:38 2022
modify_timestamp: Fri Apr 1 17:23:38 2022
2.2.刷新块存储缩容后磁盘的容量大小
1.刷新磁盘容量
[[email protected] ~]# umount /dev/rbd0
[[email protected] ~]# resize2fs /dev/rbd0mount
2.查看容量是否缩减
[[email protected] ~]# df -hT /prod
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/rbd0 ext4 9.8G 37M 9.2G 1% /prod
如果在刷新磁盘容量时,需要如下错误,那么就将磁盘进行格式化,不建议缩容操作。

边栏推荐
- CAD creation group is not combined?
- Niuke-top101-bm340
- Kubernetes-----介绍
- 蓝桥杯:第九届—“彩灯控制器”
- The applet has obtained the total records and user locations in the database collection. How to use aggregate.geonear to arrange the longitude and latitude from near to far?
- 基于OpenCV的轮廓检测(3)
- Development and design logic of rtsp/onvif protocol easynvr video platform one click upgrade scheme
- NPDP考生!7月31号考试要求在这里看!
- ELS displays a random square
- 基于c8t6芯片开发RC522模块实现呼吸灯
猜你喜欢
![[2022 Niuke Game 2 J question link with arithmetic progress] three part set three part / three part extreme value / linear equation fitting least square method](/img/4f/56033956739971d821637ae54be1bd.png)
[2022 Niuke Game 2 J question link with arithmetic progress] three part set three part / three part extreme value / linear equation fitting least square method

基于JSP&Servlet实现的众筹平台系统

JVM memory layout detailed, illustrated, well written!

MySQL index learning

机器人工程是否有红利期

Design of the multi live architecture in different places of the king glory mall

满满干货赶紧进来!!!轻松掌握C语言中的函数

Docker advanced -redis cluster configuration in docker container

Industry insight | is speech recognition really beyond human ears?

会议OA项目之我的审批&&签字功能
随机推荐
Record of a cross domain problem
MySQL index learning
Oracle basicfile lob field space recycling shrink space doubts
CAD创建组却没有组合在一起?
注意,这些地区不能参加7月NPDP考试
Kubernetes -- Introduction
【stream】并行流与顺序流
Which of the four solutions of distributed session do you think is the best?
谈一谈百度 科大讯飞 云知声的语音合成功能
社恐适合什么工作?能做自媒体吗?
STM32之IO模拟串口篇
Web服务器
【下载文件】uniapp开发小程序,下载文件并保存到本地
Design of the multi live architecture in different places of the king glory mall
方案分享 | 高手云集 共同探索重口音AI语音识别
蓝桥杯:第九届—“彩灯控制器”
ECCV 2022 | open source for generative knowledge distillation of classification, detection and segmentation
My approval of OA project (meeting inquiry & meeting signature)
分布式事务——Senta(一)
OA项目之我的审批(会议查询&会议签字)