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

边栏推荐
- 43.js -- scope chain
- 嵌入式开发:提示和技巧——用C进行防御性编程的最佳实践
- 【2022 牛客第二场J题 Link with Arithmetic Progression】三分套三分/三分极值/线性方程拟合最小二乘法
- Development and design logic of rtsp/onvif protocol easynvr video platform one click upgrade scheme
- QT专题1:实现一个简易计算器
- Pytoch correlation gradient echo
- vi命令详解
- Kubernetes -- Introduction
- [email protected]注解使用
- WEB安全基础 - - -命令执行漏洞
猜你喜欢

方案分享 | 高手云集 共同探索重口音AI语音识别

Stm32f407 ------- DSP learning

每日刷题巩固知识

Day 8 of DL

线程基础

Uniapp——拨打电话、发送短信

Es6.--promise, task queue and event cycle

c#——switch case语句

Why is it that when logging in, you clearly use the account information already in the database, but still display "user does not exist"?

嵌入式开发:提示和技巧——用C进行防御性编程的最佳实践
随机推荐
NPDP candidates! The exam requirements for July 31 are here!
vba批量读取sql的create文来创建表
Comprehensive case
基于JSP&Servlet实现的众筹平台系统
【AcWing 327. 玉米田】状压dp
Web服务器
Explanation of CNN circular training | pytorch series (XXII)
stm32F407-------DSP学习
[stream] parallel stream and sequential stream
别再用 offset 和 limit 分页了,性能太差!
els 键盘信息
Random forest and integration method learning notes
Why is it that when logging in, you clearly use the account information already in the database, but still display "user does not exist"?
Yiwen teaches you to distinguish between continuous integration, continuous delivery and continuous deployment
Promise object
Day 19 of leetcode
Day 8 of DL
社恐适合什么工作?能做自媒体吗?
Using pytorch's tensorboard visual deep learning indicators | pytorch series (25)
WEB安全基础 - - -命令执行漏洞