• xenserver 备份和还原


    1. 备份和还原xenserver host系统

    //备份
    # xe host-backup file-name=[name.xbk] -s [ip] -u [username] -pw [password]
    # xe host-backup file-name=redhat.xbk -s 127.0.0.1 -u root -pw 123456

    -s : 备份服务器地址或名称

    //还原
    # xe host-restore file-name=[name.xbk] -s [ip] -u [username] -pw [password]
    # xe host-restore file-name=redhat.xbk

    2. 备份和还原xenserver vm虚拟机

    # xe vm-export vm=[vm_uuid] filename=[filename.xva]

    首先保证vm状态(expected: halted, suspended)

    //获取虚拟机列表
    # xe vm-list
    uuid ( RO)           : 0d166725-92a8-f3a7-2817-48df158129c5
         name-label ( RW): redhat
        power-state ( RO): running
    
    uuid ( RO)           : e99ae4b3-e585-4b58-bc52-41e3d133c717
         name-label ( RW): Control domain on host: xenserver-nxhzbzto
        power-state ( RO): running
    
    //导出
    # xe vm-export vm=0d166725-92a8-f3a7-2817-48df158129c5 filename=export.xva
    
    //只导出metadata
    # xe vm-export vm=0d166725-92a8-f3a7-2817-48df158129c5 filename=export.xva --metadata
    //导入
    # xe vm-import filename=[filename.xva]
    # xe vm-import filename=export.xva
    8e5eae25-087b-e797-b6e9-35c6670ba860

    3. 备份和还原pool中的metadata

    //备份
    # xe pool-dump-database file-name=[name]
    //还原
    # xe pool-restore-database file-name=[name] dry-run=true

    4. 快照snapshot

    //创建
    # xe vm-snapshot vm=[vm_uuid] new-name-label=[name]
    # xe vm-snapshot vm=0d166725-92a8-f3a7-2817-48df158129c5 new-name-label=redhat.snapshot
    eb4d60ce-b1f5-ae62-0d40-df45b7b0b319
    
    //查看
    # xe snapshot-list
    
    //恢复
    # xe snapshot-revert snapshot-uuid=[snapshot_uuid]
    # xe snapshot-revert snapshot-uuid=eb4d60ce-b1f5-ae62-0d40-df45b7b0b319
    
    //删除
    # xe snapshot-uninstall snapshot-uuid=[snapshot_uuid]
    # xe snapshot-uninstall snapshot-uuid=eb4d60ce-b1f5-ae62-0d40-df45b7b0b319
    The following items are about to be destroyed
    VM : eb4d60ce-b1f5-ae62-0d40-df45b7b0b319 (redhat.snapshot)
    VDI: 810e4090-e9c4-4028-86a4-1a988572ef5e (redhat 0) 
    Type 'yes' to continue
    yes
    
    //删除force
    # xe snapshot-destroy snapshot-uuid=[snapshot_uuid]
    # xe snapshot-destroy snapshot-uuid=eb4d60ce-b1f5-ae62-0d40-df45b7b0b319
    
    //导出
    # xe snapshot-export-to-template snapshot-uuid=[snapshot_uuid] filename=[name.xva]
    # xe snapshot-export-to-template snapshot-uuid=eb4d60ce-b1f5-ae62-0d40-df45b7b0b319 filename=snapshot.xva
    Export succeeded
    //导入
    # xe vm-import filename=[name.xva]
    # xe vm-import filename=snapshot.xva
    d57e868f-1d95-f60a-957e-d4f571bb2205

    导入之后是模版,可以用来创建虚拟机

    5. 模版template

    //查看
    # xe template-list
    
    //删除
    # xe template-uninstall template-uuid=d57e868f-1d95-f60a-957e-d4f571bb2205
    The following items are about to be destroyed
    VM : f32d55cb-37e6-6534-7099-651cd77f7b3d (redhat (1))
    VDI: 45746899-9fbd-4e48-9b3d-70a1aadfa817 (redhat 0) 
    VDI: 9b6e4792-57d8-4cfa-b8a2-80435236dfae (Suspend image) 
    Type 'yes' to continue
    yes
    All objects destroyed

    6. vm挂起状态
    从挂起状态,强制关机

    # xe snapshot-reset-powerstate uuid=[uuid] force=true
    # xe snapshot-reset-powerstate uuid=f32d55cb-37e6-6534-7099-651cd77f7b3d force=true

    模版创建虚拟机
    XenServer三类快照

  • 相关阅读:
    【CodeForces】835D Palindromic characteristics
    【BZOJ】2006: [NOI2010]超级钢琴
    【比赛】STSRM 09
    【比赛】洛谷夏令营NOIP模拟赛
    【BZOJ】4147: [AMPPZ2014]Euclidean Nim
    【BZOJ】3895: 取石子
    【胡策08】解题报告
    【codevs】3196 黄金宝藏
    【BZOJ】1443: [JSOI2009]游戏Game
    【BZOJ】3105: [cqoi2013]新Nim游戏
  • 原文地址:https://www.cnblogs.com/zhangxuechao/p/11709866.html
Copyright © 2020-2023  润新知