zoukankan      html  css  js  c++  java
  • ceph image快照功能

    1、查看现有池
    [root@ceph-client ~]# ceph osd lspools
    0 rbd,
    注意:另创建的pool name不可含有特殊字符,如“-”等
     
    2、查看当前目录文件
    [root@ceph-client mnt]# df -Th | grep rbd
    /dev/rbd0             ext4       20G   44M   19G   1% /mnt
    [root@ceph-client mnt]# ll
    total 16
    drwx------ 2 root root 16384 Feb 26 18:32 lost+found
     
    3、创建image快照
    [root@ceph-client mnt]# rbd ls
    foo
    列出rbd池中的image
     
    [root@ceph-client mnt]# rbd snap create rbd/foo@foo_snap1
    命令模式:rbd/foo@foo_snap1代表rbd池中foo镜像,快照取名foo_snap1
     
    [root@ceph-client mnt]# rbd snap ls rbd/foo
    SNAPID NAME          SIZE
         2 foo_snap1 20480 MB
     
    4、测试快照
     
    [root@ceph-client mnt]# touch test{1..5}.file
    [root@ceph-client mnt]# ll
    total 16
    drwx------ 2 root root 16384 Feb 26 18:32 lost+found
    -rw-r--r-- 1 root root     0 Feb 29 12:45 test1.file
    -rw-r--r-- 1 root root     0 Feb 29 12:45 test2.file
    -rw-r--r-- 1 root root     0 Feb 29 12:45 test3.file
    -rw-r--r-- 1 root root     0 Feb 29 12:45 test4.file
    -rw-r--r-- 1 root root     0 Feb 29 12:45 test5.file
     
    回滚快照
    需要先卸载rbd挂载
    [root@ceph-client ~]# umount /mnt/
    [root@ceph-client ~]# rbd unmap /dev/rbd0
     
    执行回滚
    [root@ceph-client ~]# rbd snap rollback rbd/foo@foo_snap1
    Rolling back to snapshot: 100% complete...done.
     
    重新挂载
    [root@ceph-client ~]# rbd map rbd/foo
    /dev/rbd0
    [root@ceph-client ~]# mount /dev/rbd0 /mnt/
    [root@ceph-client ~]# ll /mnt/
    total 16
    drwx------ 2 root root 16384 Feb 26 18:32 lost+found
     
    验证成功
     
    5、删除快照
     
    [root@ceph-client ~]# rbd snap rm rbd/foo@foo_snap1
    删除指定快照
     
    [root@ceph-client ~]# rbd snap purge rbd/foo
    删除所有快照
     
    如果删除时报错“librbd: removing snapshot from header failed: (16) Device or resource busy”
    执行如下:
     
    [root@ceph-admin ~]# rbd snap ls images/9e196534-03e3-484f-bfab-764ef336d82a
    SNAPID NAME     SIZE
         2 snap 12047 kB
     
    [root@ceph-admin ~]# rbd snap rm images/9e196534-03e3-484f-bfab-764ef336d82a@snap
    rbd: snapshot 'snap' is protected from removal.
    2016-03-21 10:44:34.359028 7f155ac527c0 -1 librbd: removing snapshot from header failed: (16) Device or resource busy
     
    [root@ceph-admin ~]# rbd snap unprotect images/9e196534-03e3-484f-bfab-764ef336d82a@snap
     
    [root@ceph-admin ~]# rbd snap rm images/9e196534-03e3-484f-bfab-764ef336d82a@snap
     
    [root@ceph-admin ~]# rbd snap ls images/9e196534-03e3-484f-bfab-764ef336d82a
  • 相关阅读:
    pom.xml配置文件内容记录
    如何做出一个博客网站
    PHP中cookie和session的区别
    PHP链接mysql 出现:由于目标计算机积极拒绝,无法连接
    DOM增删操作(创建删除表格)
    DOM增删操作(select动态增加和删除以及清空)
    DOM增删改操作
    DOM操作表格
    SSD性能测试
    我的配置单
  • 原文地址:https://www.cnblogs.com/tonychiu/p/5766544.html
Copyright © 2011-2022 走看看