当前位置:网站首页>Capacity expansion and reduction of RBD block storage device (VI)
Capacity expansion and reduction of RBD block storage device (VI)
2022-07-28 03:37:00 【Jiangxl~】
RBD Expansion and reduction of block storage devices
List of articles
RBD Blocks are stored in use , You will definitely encounter insufficient disk space , Need to expand , You will also encounter too much disk space , At this time, it is necessary to shrink the volume .
1.RBD Expansion of block storage devices
At present RBD The space of the block storage device is 10GB, Now expand it to 20GB.

1.1. Yes RBD Expand the capacity of the underlying block storage device
from 10GB Expand to 20GB.
[[email protected] ~]# rbd resize -p ceph-rbd-data --image rbd-data.img --size 20G
Resizing image: 100% complete...done.
Check whether the block device is successfully expanded .
[[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
Block of equipment has been successfully expanded to 20GB, also Object The number of object files has also increased .
1.2. Expand the disk device mapped by the block storage device
RBD Block storage has been successfully expanded , But the mapped disk space is still 10G, Next, we need to expand the disk space .
1. If it is xfs For file systems of type, execute the following command to expand
[[email protected] ~]# xfs_growfs /dev/rbd0
2. If it is ext4 For file systems of type, execute the following command to expand
[[email protected] ~]# resize2fs /dev/rbd0
At this time, the disk space has been expanded to 20G.

2.RBD Shrink volume operation of block storage device
At present RBD The space of the block storage device is 20GB, Let's shrink it to 10GB.
2.1. Yes RBD The underlying block storage device is resized
The command is basically the same as the expansion , Just one more --allow-shrink Parameters , It means volume reduction ,--size The parameter indicates the size of the shrinkage .
The process of volume reduction is relatively slow , And may cause data loss , Generally, volume reduction is not recommended .
[[email protected] ~]# rbd resize -p ceph-rbd-data --image rbd-data.img --allow-shrink --size 10G
Resizing image: 100% complete...done.
The capacity of the block storage device is shrunk successfully , It has been reduced to 10G Capacity ,Object The number of object files has also been reduced .
[[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. Refresh the capacity of the disk after the block storage is shrunk
1. Refresh disk capacity
[[email protected] ~]# umount /dev/rbd0
[[email protected] ~]# resize2fs /dev/rbd0mount
2. Check whether the capacity is reduced
[[email protected] ~]# df -hT /prod
file system type Capacity Already used You can use Already used % Mount point
/dev/rbd0 ext4 9.8G 37M 9.2G 1% /prod
If you are refreshing the disk capacity , The following error is required , Then format the disk , Shrinking operation is not recommended .

边栏推荐
- 动态规划——63. 不同路径 II
- Leetcode 29th day
- [错题]Concatenation
- CF 7月25日-7月31日做题记录
- AIRIOT答疑第6期|如何使用二次开发引擎?
- How to make the Internet access the intranet IP (used by esp8266 web pages)
- Airiot Q & A issue 6 | how to use the secondary development engine?
- 20220726汇承科技的蓝牙模块HC-05的AT命令测试
- 695. Maximum area of the island
- 【OPENVX】对象基本使用之vx_distribution
猜你喜欢

Responsive high-end website template source code Gallery material resource download platform source code

2022最新Android Handler相关面试题总结

BRD,MRD,PRD的区别

ASEMI整流桥GBPC3510在直流有刷电机中的妙用

Robot development -- lead screw and guide rail

C语言实现动态版本的通讯录

95后阿里P7晒出工资单:真的是狠狠扎心了...

20220727使用汇承科技的蓝牙模块HC-05配对手机进行蓝牙串口的演示

Summary of concurrent programming interview questions

Weekly recommended short video: how to correctly understand the word "lean"?
随机推荐
Practice of online problem feedback module (16): realize the function of checking details
鼠标操作和响应
我的创作纪念日
LabVIEW加载和使用树型控件项目中的定制符号
Qt:QMessageBox消息框、自定义信号和槽
Unity背包系统
同时导出多个excel,并且一个excel中包含多个sheet
Outlook 教程,如何在 Outlook 中使用颜色类别和提醒?
2022-07-27: Xiao Hong got an array arr with a length of N. she is going to modify it only once. She can modify any number arr[i] in the array to a positive number not greater than P (the modified numb
Responsive high-end website template source code Gallery material resource download platform source code
[错题]Concatenation
20220727使用汇承科技的蓝牙模块HC-05配对手机进行蓝牙串口的演示
贪心——53. 最大子数组和
2022-07-27:小红拿到了一个长度为N的数组arr,她准备只进行一次修改, 可以将数组中任意一个数arr[i],修改为不大于P的正数(修改后的数必须和原数不同), 并使得所有数之和为X的倍数。
做自动化测试,你后悔了吗?
Shell writing specifications and variables
STM32 RT thread virtual file system mount operation
CF question making record from July 25th to July 31st
How to make the Internet access the intranet IP (used by esp8266 web pages)
光年(Light Year Admin)后台管理系统模板