1.查看image中内容
[root@ceph-client u01]# ll total 20 -rw-r--r-- 1 root root 20 Nov 17 16:40 ceph.txt drwx------ 2 root root 16384 Nov 17 16:38 lost+found [root@ceph-client u01]# cat ceph.txt Learning ceph snap!
2.导出image
[root@ceph-client ~]# rbd export data /root/data Exporting image: 100% complete...done.
--iamge名称,和导出路径及文件名称
[root@ceph-client ~]# ll /root/data -rw-r--r-- 1 root root 53687091200 Nov 17 19:06 /root/data
#导出文件大小
[root@ceph-client ~]# du -sh /root/data 533M/root/data
2.1将导出的文件再挂载到其他目录下
#查看导入文件类型
[root@ceph-client ~]# file data data: Linux rev 1.0 ext4 filesystem data, UUID=4a65a4e0-419e-4826-bbce-ddbc28b8922b (needs journal recovery) (extents) (64bit) (large files) (huge files)
2.1.1查看空闲的loop设备
[root@ceph-client ~]# losetup -f /dev/loop0 [root@ceph-client ~]# losetup /dev/loop loop0 loop-control
2.1.2挂载
[root@ceph-client ~]# losetup /dev/loop0 data
2.1.3创建目录并挂载目录
[root@ceph-client ~]# mkdir /test_tmp [root@ceph-client ~]# mount /dev/loop0 /test_tmp/
2.1.4查看目录中文件,文件是对的
[root@ceph-client ~]# ll /test_tmp/ total 20 -rw-r--r-- 1 root root 20 Nov 17 16:40 ceph.txt drwx------ 2 root root 16384 Nov 17 16:38 lost+found [root@ceph-client ~]# cat /test_tmp/ceph.txt Learning ceph snap!
3.导入
3.1删除data image数据
[root@ceph-client ~]# cd /u01 [root@ceph-client u01]# ll total 20 -rw-r--r-- 1 root root 20 Nov 17 16:40 ceph.txt drwx------ 2 root root 16384 Nov 17 16:38 lost+found [root@ceph-client u01]# rm ceph.txt rm: remove regular file ‘ceph.txt’? yes [root@ceph-client u01]# ls lost+found
3.2导入iamge备份文件
[root@ceph-client ~]# rbd import /root/data data rbd: image creation failed Importing image: 0% complete...failed. rbd: import failed: (17) File exists 2016-11-17 19:15:36.314780 7fa190639d80 -1 librbd: rbd image data already exists
这里报错了,原因是:不能导入到相同的image中,然后导入到同一个pool中一个不存在的image中。
[root@ceph-client ~]# rbd import /root/data data02 Importing image: 100% complete...done.
--data02是不存在的,在导入过程中ceph会自动创建image并导入数据,导入过程不是很快。
3.3查看新iamge data02信息
[root@ceph-client ~]# rbd info data02 rbd image 'data02': size 51200 MB in 12800 objects order 22 (4096 kB objects) block_name_prefix: rbd_data.fbd22ae8944a format: 2 features: layering, exclusive-lock, object-map, fast-diff, deep-flatten flags:
版权声明:本文为博主原创文章,未经博主允许不得转载。
ceph 导出 导入
- 上一篇:ceph创建快照及快照回滚
- 下一篇:Python psutil模块的使用介绍