当前位置:网站首页>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
如果在刷新磁盘容量时,需要如下错误,那么就将磁盘进行格式化,不建议缩容操作。

边栏推荐
- Decision tree and random forest learning notes (1)
- Uniapp——拨打电话、发送短信
- Confusion matrix in CNN | pytorch series (XXIII)
- Scheme sharing | experts gather to jointly explore accent AI speech recognition
- 微服务架构统一安全认证设计与实践
- Where do I go to open an account for stock speculation? Is it safe to open an account on my mobile phone
- Original title of Blue Bridge Cup
- [stream] basic knowledge of stream
- 分布式事务——Senta(一)
- [red team] att & CK - file hiding
猜你喜欢

Vscode debug displays multiple columns of data

Es6.--promise, task queue and event cycle

意外收获史诗级分布式资源,从基础到进阶都干货满满,大佬就是强!

嵌入式开发:提示和技巧——用C进行防御性编程的最佳实践

数据湖:海量日志采集引擎Flume

Unexpected harvest of epic distributed resources, from basic to advanced are full of dry goods, big guys are strong!

Kubernetes -- Introduction

Actual case of ROS communication

Promise object

JVM memory layout detailed, illustrated, well written!
随机推荐
My approval & signature function of conference OA project
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?
分布式 session 的4个解决方案,你觉得哪个最好?
线程基础
注意,这些地区不能参加7月NPDP考试
Superparameter adjustment and experiment - training depth neural network | pytorch series (26)
为什么登录时,明明使用的是数据库里已经有的账号信息,但依旧显示“用户不存在”?
CAD创建组却没有组合在一起?
STM32之IO模拟串口篇
Oracle basicfile lob field space recycling shrink space doubts
蓝桥杯原题
基于JSP&Servlet实现的众筹平台系统
Record of a cross domain problem
NPDP candidates! The exam requirements for July 31 are here!
@The function of valid (cascade verification) and the explanation of common constraint annotations
Kubernetes -- Introduction
综合 案例
QT专题1:实现一个简易计算器
Original title of Blue Bridge Cup
style=“width: ___“ VS width=“___“