''s profileKT' Cheung's Space 【 张智波...PhotosBlogListsMore Tools Help

Blog


    November 01

    VISBU

    又在 epie  那找到好东西咯, 当然就是 [ VISBU ]...
     
    引用 epie :
    ****************************************************************************************

    一款vmware的备份软件,此软件是安装在service console上的,那基本上就代表了无法集中管理,适合小规模Vm环境

    但是它是Free的,而且支持schedule task,应该比VCB强。国外有人推荐,我顺便贴出来share下

    具体效果如何,目前比较忙,没时间测试。等测试完,再分享下原理和优缺点

    VISBU is free backup software that is run from the Service Console that provides VMDK level backups of any VM on storage accessible by the host. The script can be targeted at any ESX server or VC server. The script is designed to be easy to use and offers all features from a simple menu driven interface, so a non-Linux administrator can use it with the minimum of fuss.

    It provides email reports, automated restoration for every backed up VM, scheduling, is DRS aware, and supports backups to SMB, NFS, EXT3, iSCSI and SAN based volumes.

    http://engineering.xtravirt.com/products/visbu.html

    *****************************************************************************************

    测试了一下,确实很不错,速度和在ESX下用VCB一样的,log提示也很清晰.

    不过该备份软件仅限于热备,对于power off的VM,似乎是无法backup的.

    另外,对于epie的"代表无法集中管理,适合小规模环境",本人发表以下看法(该看法只是与epie兄弟做学术交流):

    该软件也可以集中式管理,虽然有点别扭,但是确实可行.本人亲测.
    在ESX中的/etc/hosts中,加上以下语句:

    192.168.1.100 virtual_center.vmware.com virtual_center

    在备份的时候,输入备份的hostname时,输入virtual_center.vmware.com, 帐号密码当然就是VC的ID和PWD啦.

    这时候,是可以备份VC中全部POWER ON状态的VM到本地的.

    当然,如果VC管理的ESX都是FC连接的存储,再从存储来一个BACK UP的LUN连接到这台ESX, 那么就是一件美事了.

    不知道epie兄弟有何看法?

     

    October 24

    VCB故障排错

    转载于epie's blog:

    • 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
      http://epie.blogbus.com/logs/30024926.html

      打开debug的开关:

      打开"C:\Program Files\VMware\VMware Consolidated Backup Framework\generic\glue.js".

      查找"function PrepareForBackup".

      它下面应该跟着这样的字符串: cmd = StdCommandTemplate(vmMounterCmd);
      在它后面加一行 cmd += " -L 6 ";

      保存后再执行一次备份,
      在%WINDIR%\Temp目录下应该有更详细的Log文件
      pre_ESX-(File|FullVM)MDDYYYYHHmmSS.log
      post_ESX-(File|FullVM)MDDYYYYHHmmSS.log

       转:Troubleshooting VMware Consolidated Backup (VCB)

      2007-05-28 20:57
      VMware Consolidated Backup (VCB), an optional component of VMware's Virtual Infrastructure 3 (VI3), can be hard to configure and produces unhelpful error messages. This tip can help you get more debugging information outputted to the VCB log files, understand that info, and resolve VCB issues quickly and successfully.

      VCB is VMware's attempt to provide an enterprise level backup solution for ESX. It is a very good effort, although it lacks in some fairly major areas. Some may compare it to the popular esxRanger software, but it may not be fair to make comparisons between a mature product and one that is still relatively new. Only time will tell what is made of VCB. For now, here are some tips that can help unravel some of this backup solution's Gordian knots."

      So you've got VCB talking to your VirtualCenter Management Server, but you just cannot seem to get it back up your virtual machines (VM). The first step to figuring out what is going wrong is to increase the amount of debugging information that gets outputted to the VCB log files. Use notepad to open the following file, "C:\Program Files\VMware\VMware Consolidated Backup Framework\generic\glue.js". Search for the string "function PrepareForBackup". This will zoom to the function responsible for building the command that mounts the VMs for backup. Near the beginning of the function there is a line that reads:

      cmd = StdCommandTemplate(vmMounterCmd);

      Directly underneath this line insert the following text:

      cmd += " -L 6 ";

      Save the file and close notepad. Subsequent VCB executions will now generate verbose logs located in the temporary directory of the user who is running the backup process. Since most backup processes run as SYSTEM (unless one is executed manually outside the scope of the backup software by an administrator) the log files will be located in %WINDIR%\Temp. The log files adhere to the following naming convention:

      pre_ESX-(File|FullVM)MDDYYYYHHmmSS.log and
      post_ESX-(File|FullVM)MDDYYYYHHmmSS.log
      

      The interesting information is going to be in the pre logs. Once the logging has been turned up, go ahead and attempt a backup of the VMs. After the backup job fails, it is time to examine the log file. Use the following guide as a way of determining where the problem is and how to fix it.

      ERROR MESSAGE
      Error: Snapshot creation failed: This operation is not supported.

      PROBLEM
      The VM in question appears to not have had its virtual hardware upgraded from an earlier version of ESX. Even the most vigilant ESX administrator can fall prey to this problem because although all VMs were upgraded when ESX was upgraded to 3.x, the template were not. If templates created in an earlier version of ESX are not upgraded as well, then VMs stamped out of those templates will still be using an previous virtual hardware version.

      SOLUTION
      Power off the VM, right-click on it, and select "Upgrade Hardware."

      ERROR MESSAGE
      Does not report an IP address.

      PROBLEM
      The VM's guest operating system (OS) in question either does not have the VMware Tools installed, the VMware Tools are not running, or they are corrupted.

      SOLUTION
      Install VMware Tools inside the VM's guest OS, ensure that they are running, or possibly reinstall them.

      ERROR MESSAGE
      Could not resolve IP address.

      PROBLEM
      VCB requires that all VMs have resolvable IP addresses. If the VM's name does not resolve to a valid IP address then VCB will fail to back it up.

      SOLUTION
      Ensure that the VM is resolvable via DNS. If for some reason you cannot create a DNS entry for this VM then edit the Windows hosts file at %WINDIR%\system32\drivers\etc\hosts on the VCB backup proxy and create a static entry for this VM.

      ERROR MESSAGE
      Failed to communicate with the remote host, either due to network errors or because the host is not responding.

      PROBLEM
      This message can be indicative of a misconfigured or corrupted VMware Tools installation. This message can also occur when there is a problem reading the VM's existing snapshots.

      SOLUTION
      Reinstall VMware Tools. If that does not fix the problem then it may be necessary to remove the VM's snapshots one at a time until the backup operation succeeds.

      ERROR MESSAGE
      Error: Failed to open the disk: One LUN could not be opened.

      PROBLEM
      This message means that the LUN IDs of the ESX LUNs as they are presented to the VCB backup proxy are not in the same order as they are on the ESX servers. VCB requires that the VCB backup proxy and the ESX servers each see the same LUNs in the same order. Adapter and Target IDs do not matter, only the LUN ID.

      SOLUTION
      Remove all of the ESX LUNs from the VCB backup proxy and re-add them in the same order that they were added to the ESX servers.

      ERROR MESSAGE
      Error: Could not find virtual machine specified by ipaddr

      PROBLEM
      This message means that the a successful vcbMounter command has never been executed against the VM in question. The first time vcbMounter is executed successfully against a VM it will cache the VM's IP address. If this IP address is not in the cache or if it cannot be obtained then the backup operation will fail. This typically occurs when VCB is trying to back up a VM that is powered off and has no cached IP address, or VCB is attempting to backup a VM that does not have VMware Tools installed.

      SOLUTION
      It may be necessary to power on the VM and execute the vcbMounter command so that the VM's IP address will be cached as well as making sure that the VM has the VMware Tools package installed.

      ERROR MESSAGE
      Error: Backup snapshot already exists.

      PROBLEM
      This is indicative of a previous backup attempt by VCB that did not clean up its snapshot after the backup operation.

      SOLUTION
      Manually remove the snapshot "_VCB-BACKUP_" from the VM.

      I hope this article has helped its readers figure out some of the harder-to-solve issues that can crop of with VCB. I will be writing an upcoming series for SearchServerVirtualization.com called "Getting Started with VMware Consolidated Backup (VCB)," where I detail how to start using VCB from start to finish. Stay tuned!

    July 14

    变通式VMware Consolidated Backup方法

    应该值得开心一下!
    因为终于使用VCB有点体会了.
     
    楼下丹麦哥们备份的shell写的不错,如果在整个过程中加上echo,会更完美些..
    不过总体而言,速度还是不错的,毕竟在本地上进行备份,可以避免不少的麻烦,但是备份后再scp?虽然这是官方推荐,但是我觉得有些恶心,毕竟这就是蜗牛的速度了.
    这也是没有共享存储,而又想体验一下VCB的方法.
     
     
    总觉得VCB不能鱼和熊掌兼得.如果在本机上做备份,即使虚拟机是Linux,那么也照样备份,这确实很理想,如果是远程的VCB PROXY,那么就等于废了,对于使用Linux的用户简直就是噩梦..
     
    不过,还是想尝试尝试,结合Tooms的bash.
     
    1)在远程机器Windows 2003上共享一文件夹,命名"vcb_remote"
    2)在ESX内挂载该文件夹.   
     
    [root@esx102 tmp]# mkdir vcb_remote
    [root@esx102 tmp]# mount -t smbfs -o username=administrator,password=VMware.com //192.168.11.22/vcb_remote /tmp/vcb_remote
    (注意端口是否开放)
     
    3)在Tooms的bash上将备份路径修改为/tmp/vcb_remote即可.
     
    4)备份:
    执行 ./backup
     
    =======================================================
    整个过程还是很安静,很缓慢的过程.毕竟这和先备份再scp没分别..出奇的慢, 每秒5M的速度,备份一个15G的Virtual machine要老半天,怎么混..
    =======================================================
    不过庆幸的是,各种各样的方法总是有的...在多方面的约束下还能实现,才是最重要的...
     
     

    VMware ESX 3.0 VM Backup script by Tooms

    I was looking around the internet for a backup script to backup the VM guests on a standalone ESX 3.0 and was not finding any so I start to make my own.

    Things I need the script to-do was.

    • HOT Backup of all VM guest on the server
    • Backup of VM guests in any power state
    • Backup to a local folder on the server where the remote backup server will pick them from and put it to tapes
    • Auto cleanup of old backup log and VM files (older then 1 day)
    • Execute one script if there was a error and another if there was no error
    • No SAN, work on a standalone ESX server with local storage

    and yes I know esxRanger 2.0 for ESX 3.0 can do all this, but that product was not finish and public when I start to make this script, maybe I will change to esxRanger but that will time tell or maybe I will use them both


    Please be nice as this is my first Linux bash script and I am just a windows admin ;-) so there is for sure a number of error and smarter ways to do thing, but it works for me.. and if you give me feedback I will fix the script.



    Here is the script and how to use it

    1. login
    login as root on the ESX 3.0 console


    2. edit backuptools.conf
    First edit the /etc/vmware/backuptools.conf file by running the command "nano /etc/vmware/backuptools.conf"
    This is need in order for the vmware backup tools to work...
    Out comment the red lines and put in the blue lines


    #
    # URL for the VC SDK instance to connect to. The format is
    # [:port]
    #
    # VCHOST=myvirtualcenter.company.com
    VCHOST=localhost

    #
    # Username to use for VC SDK authentication
    #
    # USERNAME=backup
    USERNAME=root

    #
    # Password to user for VC SDK authentication
    # WARNING: It is recommended that you don't specify the
    # password in the configuration file.
    #
    # PASSWORD=XXX
    PASSWORD=YourPassword

    note the best thing will be to make a account for backup and not use the root account.

    3. make a folder for the backup script
    make a folder with the command "mkdir /etc/esxbackup"


    4. backup script
    make the script by using the command "nano
    /etc/esxbackup/backup.bash" and copy the script below into it.
    change the $TOfolder to be where you like the backup to be put.

    ###########################################################################
    #!/bin/bash
    #
    # ESX 3.0 Backup script build by Tooms@tooms.dk
    #
    # 20060905 Minor fixs by tooms
    # 20060830 First version by tooms
    #
    # Change the $TOfolder to be the folder where the backup files will be placed in
    #
    #


    ###########################################################################
    # Path the vmware apps need.
    PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"


    ###########################################################################
    # the base Path where the backup will be placed
    # Change this path to match your setup
    TOfolder=/vmfs/volumes/storage1/backup


    ############################################################################
    # make the sub folder name ready from date/time
    DTfolder=$(date '+%Y%m%d-%H%M')


    ############################################################################
    # making the base folders ready if not exist
    if test ! -x "$TOfolder" ; then
      mkdir -p $TOfolder
    fi


    ############################################################################
    # make a log file ready
    rm -f $TOfolder/backup.log
    Backuplog=$TOfolder/backup.log
    echo " " >>$Backuplog
    echo "The Date/time is $(date '+%Y%m%d-%H%M%S')" >>$Backuplog
    echo " " >>$Backuplog


    ############################################################################
    # making the sub-folders ready if there not exist
    if test ! -x "$TOfolder/$DTfolder" ; then
      echo "Make folder: $TOfolder/$DTfolder" >>$Backuplog
      mkdir -p $TOfolder/$DTfolder
    fi
    if test ! -x "$TOfolder/$DTfolder/vm" ; then
      echo "Make folder: $TOfolder/$DTfolder/vm" >>$Backuplog
      mkdir -p $TOfolder/$DTfolder/vm
    fi
    if test ! -x "$TOfolder/$DTfolder/log" ; then
      echo "Make folder: $TOfolder/$DTfolder/log" >>$Backuplog
      mkdir -p $TOfolder/$DTfolder/log
    fi


    ############################################################################
    # move backup log to the new subfolder
    mv $TOfolder/backup.log $TOfolder/$DTfolder/log/
    Backuplog=$TOfolder/$DTfolder/log/backup.log
    echo " " >>$Backuplog
    echo "Move backup log to $Backuplog" >>$Backuplog


    ############################################################################
    # build content log of $TOfolder before backup and cleanup
    echo " " >>$Backuplog
    echo "Build content_before.log of $TOfolder before backup and cleanup" >>$Backuplog
    ls -R -la $TOfolder >>$TOfolder/$DTfolder/log/content_before.log


    ############################################################################
    # Delete content from the $TOfolder there is older then 1 day
    echo " " >>$Backuplog
    echo "Delete content from the $TOfolder there is older then 1 day" >>$Backuplog
    find $TOfolder/* -type d -maxdepth 0 -mtime +1 -exec rm -d -r -f -v {} >>$Backuplog \;


    ############################################################################
    # Delete old vcbSnapAll logfiles from /var/log/vmware/ there is older then 1 day
    echo " " >>$Backuplog
    echo "Delete old vcbSnapAll logfiles from /var/log/vmware/ there is older then 5 min." >>$Backuplog
    find /var/log/vmware/vcbSnapAll-* -type d -maxdepth 0 -mtime +1 -exec rm -d -r -f -v {} >>$Backuplog \;


    ############################################################################
    # make the VM export/backup
    echo " " >>$Backuplog
    echo "Laver export af alle VM" >>$Backuplog
    vcbSnapAll -a any -r $TOfolder/$DTfolder/vm/ -L 6 >>$Backuplog


    ############################################################################
    # Getting the exitcode from vcbSnapAll
    vcbSnapAll_exitcode=$(expr $?)
    echo " " >>$Backuplog
    echo "The exitcode is $vcbSnapAll_exitcode" >>$Backuplog


    ############################################################################
    # copy the vcbSnapAll logfiles to the logfolder
    echo " " >>$Backuplog
    echo "copy the vcbSnapAll logfiles to $TOfolder/$DTfolder/log/" >>$Backuplog
    cp -r -v /var/log/vmware/vcbSnapAll-* $TOfolder/$DTfolder/log/ >>$Backuplog


    ############################################################################
    # build content log of $TOfolder after backup and cleanup
    echo " " >>$Backuplog
    echo "Build content_after.log of $TOfolder after backup and cleanup" >>$Backuplog
    ls -R -la $TOfolder >>$TOfolder/$DTfolder/log/content_after.log


    ############################################################################
    # write end time in logfile
    echo " " >>$Backuplog
    echo "The Date/time is $(date '+%Y%m%d-%H%M%S')" >>$Backuplog


    ############################################################################
    # Checking for errors
    echo " " >>$Backuplog
    if [ $vcbSnapAll_exitcode = 0 ]; then
      echo "Error: none" >>$Backuplog
      echo " " >>$Backuplog
      #run script if all okey !
    else
      echo "Error: got exitcode $vcbSnapAll_exitcode" >>$Backuplog
      echo " " >>$Backuplog
      #run script if there is a error !
    fi



    5. Make it a script
    run this command "chmod 777 /etc/esxbackup/backup.bash" to make it a script there can be run from the commandline


    6. When to run the backup
    edit the crontap fil with the command "nano /etc/crontap" to run the script at 21:00 every evening
    Add the line mark with blue

    SHELL=/bin/bash
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    MAILTO=root
    HOME=/

    # run-parts
    01 * * * * root run-parts /etc/cron.hourly
    02 4 * * * root run-parts /etc/cron.daily
    22 4 * * 0 root run-parts /etc/cron.weekly
    42 4 1 * * root run-parts /etc/cron.monthly
    00 21 * * * root /etc/esxbackup/backup.bash
     


    7. Try the script
    Try the script by running the command "/etc/esxbackup/backup.bash"


    8. Look at the backup log
    Look at the backup log with the command "nano /vmfs/volumes/storage1/backup/20060905-1800/log/backup.log"
    note that the path will offcource not be the same when you use it...


    9. Backup to tape
    Now setup your remote backup server to backup any thing in the /vmfs/volumes/storage1/backup folder, I use Backup Exec 10D on a windows server with the backup exec 9.1 linux agent installed in the ESX 3.0 server COS.
    That works very well with backup speed at around 1500mb/min over a 1gbit network with a LTO3 24 tape autoloader from Dell on the windows server.



    And yes before you ask how to restore a VM from the backup folder......
    First turn off the VM there need to be restore and do like this

    [root@ESX3 root]# vcbRestore -s /vmfs/volumes/storage1/backup/20060905-1800/vm/vm01/ -b overwrite
    [2006-09-06 18:30:00.140 'App' 3076448384 info] Current working directory: /root
    [2006-09-06 18:30:00.157 'BaseLibs' 11344816 warning] [Vmdb_Unset] Unsetting unknown path: /vmomi/

    Converting "/vmfs/volumes/storage2//VM_vm01/vm01.vmdk" (VMFS (flat)):
    0%=====================50%=====================100%
    **************************************************

    [root@ESX3 root]#
     

    Now turn on the VM that is just restore and verify it is working.


    hope this help you on the way and works on your box, let me know in the forum if you have any smart things there need to be add to the backup script and I will then update it from time to time...


    not bad from a windows admin with only a very little linux skills ;-)

    June 01

    VMware VI3 虚拟机热备份的几种方法

    VM 热备份有几种方式:
    1) 利用CONVERTER, 或第三方工具, 如 Platespin, Vizioncore 的产品等.
    2) 在VCB PROXY服务器上通过VCB来热备
    3) 或是在ESX的SERVICE CONSOLE上通过vcbMounter或vmware-cmd工具来完成. 这里主要说说第3种, 也是ESX管理中最常用的
    1. vcbMounter是ESX3附带的VM备份工具. 它可以对运行中的VM进行热备份, 后备的内容包括盘数据, 内存数据和VM的配置数据等. vcbMounter后备产生的IMAGE可用做VM的备份及灾后复原. 一个典型的vcbMounter例子:
    >vcbMounter -h esxhost -u backupuser -p password -a ipaddr:192.168.10.1 -r /vmfs/volumes/SAN1/vm-backups/vm1
    -h: 指定执行命令的ESX HOST 或 VIRTUAL CENTER.
    -u: 执行命令的帐户, 如果-h指定的是ESX, 要用该ESX上的帐户, 如果是VC, 则要用VC上的帐户
    -p: 帐户的PASSWORD
    -a: 指定后备的VM, 可以用, IP, FQDN, VM名等
    -r: 指定存放备份IAMGE的目录. 可以在本地或共享存储上
    使用上述命令产生VM后备时, VM的所有盘文件被切割成2GB的小文件集并进行了压缩. 比如VM有两个半满的10GB的盘(20GB IN SIZE, 10GB IN USED), 后备的结果是产生了10个小盘文件, 10个小文件的总SIZE等于10GB, 就是你VM中的已用的容量.
    由于上述vcbMounter并非简单将原VM的盘文件考出来(而是进行了分割和压缩), 所以复原的时候也需要采用工具(ESX3附带): vcbRestore来进行. 如果你只是想将VM的盘文件原封不动热备出来, 则须修改上述命令:
    >vcbMounter -h esxhost -u backupuser -p password -a ipaddr:192.168.10.1 -r /vmfs/volumes/SAN1/vm-backups/vm1 -M 1 -F 1
    -M 1: 不分割.
    -F 1: 不压缩.
    这样在热备时盘文件就不被切割和压缩了.
    2. 使用vmware-cmd或vcbSnapshot对运行中的VM建立快照snapshot, 然后再将其vmdk盘文件考出来.
    ESX3.0下使用vmware-cmd热备的例子:
    a)建立snapshot
    >vmware-cmd -H esx01 -U root -P rootpass /vmfs/volumes/6001....4728/VM1/VM1.vmx createsnapshot snapshot1 first-snapshot 1 0
    -H: 指定执行命令的ESX HOST 或 VIRTUAL CENTER.
    -U: 执行命令的帐户.
    -P: 帐户的PASSWORD
    vmfs/volumes/6001....4728/VM1/VM1.vmx: 被拷贝VM配置文件的路径.
    createsnapshot: 建立snapshot.
    snapshot1: snapshot名
    first-snapshot: snapshot注释
    1: 启动ESX的VM quiesce 功能.建立snapshot静止VM, 可以使安装了vmware-tools的WINDOWS VM保持OS级的数据一致性.
    0: snapshot不保存内存.
    b)用vmkfstools将要热备的盘文件拷贝.
    c)去除快照:
    >vmware-cmd -H esx01 -U root -P rootpass /vmfs/volumes/6001....4728/VM1/VM1.vmx removesnapshots
    注意上述命令去除该VM上的所有快照. 如果你VM的VM在进行步骤 a)之前以有快照, 这时会被一并去除.
    在拷贝前建立快照的目的是截断VM对原始盘文件的操作, 保持原始盘文件的数据一致性, 拷贝输出完成以后, 再将快照去除.
    为VM建立块照snapshot时, ESX为VM的每一个vmdk文件建立一个相应的delta文件, 快照建立以后, VM的盘操作便不在原始盘文件进行,而改在delta文件上进行. 这样原始盘文件便处与稳定状态可被拷贝.
    3. 采用vcbSnapshot命令来热备VM
    VI3引入一个新命令可供建立snapshots. 利用它来为VM做热备的原理与 2) 并没有太大的区别. 基本的步骤:
    a) 使用 vcbVmName 来确定VM的 ID
    b) 使用 vcbSnapshot 为VM建立 Snapshot
    c) 使用 vcbExport 来输出VM的盘文件.
    d) 最后使用 vcbSnapshot 来删除 a) 建立的snapshot.

    May 28

    Consolidate Backup备份出现错物提示:Error:Failed to export the disk: I/O Operation failed.

    很经典的问题,在使用VCB备份时出现
    Error:Failed to export the disk: I/O Operation failed
    的错误提示,搜索了一下VMTN,也大有人在..
     
    解决方案:
    修改/etc/vmware/hostd/config.xml文件.
     
    找到以下语句,并添加高亮部分:
     
    <blklistsvc>
    <enable>true</enable>
    <leaseTimeSecs>180</leaseTimeSecs>
    </blklistsvc>
    May 12

    用vcbRestore將VM回復到另一台ESX上

    修改catalog文件:
     
    vi 虛擬機器中的catalog file
     
    version= esx-3.0
    state= poweredOn
    display_name= "Win2000Pro"
    uuid= "564d617f-26af-80b9-a93b-1c542015b355"
    disk.scsi0:0.filename= "scsi0-0-0-Win2000Pro.vmdk"
    disk.scsi0:0.diskname= "[ESX02-storage1] Win2000Pro/Win2000Pro.vmdk"
    config.vmx= "[ESX02-storage1] Win2000Pro/Win2000Pro.vmx"
    host= ESX02.tw.fedex.com
    timestamp= "Mon Sep 3 08:54:36 2007"
    config.suspenddir= "[ESX02-storage1] Win2000Pro/."
    config.snapshotdir= "[ESX02-storage1] Win2000Pro"
    config.file0= "Win2000Pro.vmsd"
    config.file1= "Win2000Pro.vmxf"
    config.file2= "Win2000Pro.nvram"
    config.logdir= "[ESX02-storage1] Win2000Pro"
    config.log0= "vmware-7.log"
    config.log1= "vmware-8.log"
    config.log2= "vmware-9.log"
    config.log3= "vmware-10.log"
    config.log4= "vmware-11.log"
    config.log5= "vmware-6.log"
    config.log6= "vmware.log"
    folderpath= "/ha-folder-root/ha-datacenter/vm"
    resourcepool= "/ha-folder-root/ha-datacenter/host/ESX02-Server/Resources/Production"
     
    基本上只要修改3種設定
    [ESX02-storage1] -> 改成 另一台ESX storage name
    ESX02-Server -> 改成 另一台 ESX Server Name
    Production -> 改成 另一台 你想要存放的 Resource Pool Name

    May 10

    VCB Backup RHEL严重挫折历程--哭吖

    "太阳"!--先骂粗出口发泄一下,希望大家别介意.

    挫折:

    试验环境:ESX 3.5.0,82663    GuestOS:Red Hat Enterprise Linux AS4

    本人只不过是想使用Consolidate Backup备份一下该Virtual Machine罢了,做下实验操作,差点折磨死我了...

    在此,还得对我的好友"housefull"表示强烈的感谢,谢谢他在该过程中对我的不离不弃(太恶心了这句),悉心教导...

    刚开始使用的是一台名为"in red hat3"的RHEL,该OS在设置好ip地址,安装完vm-tools后,却发现在"Summary"的地方现实IP地址与VMware Tools,DNS name均为空,该证明了我的VM-tools其实未被生效.
    恶心的是重启该VM OS,ip并未保存下来,我还得ifconfig一次,重启,又没了,vi 写入到/etc/sysconfig/network-scripts/ifcfg-eth0,依然无效,netconfig设置,ifup or ifdown的时候,竟然发现键盘的灯在闪吖闪,闪吖闪,该OS出现假死现象...

    难怪在ESX对使用vcbMounter对其做backup老出现错误,也不出奇了..

    没法了,这台RHEL平时都是被我折磨的,出先这种问题也不奇怪,算了,还是换台VM做实验吧.

    于是换了台命名为"in red hat4"的RHEL,以前批量安装的VM,这台还没"破处",恰到好处,于是在里面设置好IP,安装完vmware-tools后,好了,总算在Summary里面看到了一些信息,不过显示vmware-tools版本太旧,于是更新vmware-tools,更新完毕后,重启动该OS,一切正常.

    使用
    [root@esx102 root]# vcbMounter -h 10.3.131.80 -u root -p vmware -a ipaddr:10.3.131.89 -r /vmfs/volumes/lun2/vcb_linux_katooo

    -----提示错误如下----
    [2008-05-10 11:18:29.553 'App' 3076449088 info] Current working directory: /root
    [2008-05-10 11:18:30.350 'vcbMounter' 3076449088 error] Error: Other error encountered: Snapshot creation failed: Custom pre-freeze script failed.

           崩溃,怎么又会出错,hosufull解释:

           因为你是在vm运行的情况下做vcb,  在做vcb时,先要freeze冰冻vm,然后做snapshot,
           但是上面的应用对i/o读写有特殊要求, vcb冰冻vm不了这些vm,所以会出错

           看来VCB对Linux的Backup还真是有点不足.没法,尝试关闭VM OS,对关闭的VM做Backup吧,使用:

    [root@esx102 root]# vcbMounter -h 10.3.131.80 -u root -p vmware -a name:"in red hat4" -r /vmfs/volumes/lun2/vcb_linux
    [2008-05-10 11:36:33.726 'App' 3076469568 info] Current working directory: /root
    Copying "[storage1] in red hat4/in red hat4.vmx":
            0%=====================50%=====================100%
            **************************************************

    Copying "[storage1] in red hat4/in red hat4.nvram":
            0%=====================50%=====================100%
            **************************************************

    Copying "[storage1] in red hat4/vmware-1.log":
            0%=====================50%=====================100%
            **************************************************

    Copying "[storage1] in red hat4/vmware-2.log":
            0%=====================50%=====================100%
            **************************************************

    Copying "[storage1] in red hat4/vmware.log":
            0%=====================50%=====================100%
            **************************************************

    Converting "/vmfs/volumes/lun2/vcb_linux/scsi0-0-0-in red hat4.vmdk" (compact file):
            0%=====================50%=====================100%
            **************************************************

    舒服,总算可以备份了..OK,尝试破坏该虚拟机的配置文件和.vmdk文件,都删除掉,启动时,提示错误--不提示才怪..>.<

    尝试恢复,使用以下命令:

    [root@esx102 vcb_linux]# vcbRestore -h 10.3.131.80 -u root -p vmware -s /vmfs/volumes/lun2/vcb_linux/
    [2008-05-10 11:47:20.290 'App' 3076449088 info] Current working directory: /vmfs/volumes/47e352b4-379023b2-5e50-001e0b75d2d6/vcb_linux
    Converting "/vmfs/volumes/storage1/in red hat4/in red hat4.vmdk" (VMFS (flat)):
            0%=====================50%=====================100%
            **************************************************

    OK,还原成功..

    后来又尝试修改虚拟磁盘,再做VCB备份,谁知道我自己把磁盘乱改一通后,最后连kernel文件也在启动的时候找不到了..

    被迫使用第3台RHEL5-SERVER进行备份,嘿嘿~~我只是抱着尽管试一试的心情,没安装VM-TOOLS,只改了IP后,直接使用:

    [root@esx102 lun2]# vcbMounter -h 10.3.131.80 -u root -p vmware -a name:"RHEL5-SERVER-I386" -r /vmfs/volumes/lun2/vcb_backup_rhel5

    忽然....备份成功了....而且此时RHEL5状态为online...此时此刻证明了上面所写的一切都有所保留..出现freeze错误提示的,是因为我用了ipaddr:而导致的问题?
    ....这一切无从考验....因为那台RHEL4的VM已经删除了,而且没有备份..难道要我再重装实验?~好崩溃的问题...

    不过无论如何,Consolidated Backup对LINUX的online备份还是可以的,而且如果使用-a name:去备份的话,屡试不爽...也抛开了vm-tools的麻烦..

    March 09

    [Kt'Cheong原创]VMware Consolidated Backcp教程(一) Backing Up With VMware Infrastructure

        備份,恢復和災難恢復時數據管理當中最常見的處理方法。VMware Infrastructure和VMware ESX Server提供了很多不同的解決方案,他們各自適用于不同的環境,以用來執行備份和還原的任務。

        這個介紹説明了ESX Server那些資源會被備份,和解釋備份時哪些選項會被使用到。

        包括以下章節:

        ◆備份的概念

        ◆備份什麽

        ◆備份的組成和途徑

        ◆使用傳統的備份模式

        ◆使用VMware Consolidated Backup

     

    備份的概念

        ◆差量備份(Differential backup)--備份最近一次“全備份”后被修改過的文件的備份模式。

        ◆文件等級備份(File‐level backup)--一种被指定文件或者文件夾等級的備份類型。

        ◆全備份(Full backup)--備份或有被選定的文件。

        ◆所有虛擬機備份(Full virtual machine backup)--備份所有的文件包括整個完整的虛擬機。這些文件包括磁盤鏡像,.vmdk文件等等。

        ◆鏡像(卷)等級備份(Image‐level (volume‐level) backup)--備份整個完整的存儲邏輯卷。

        ◆增量備份(Incremental backup)--只備份上一次備份后改變的文件,無論上次是全備份或者增量備份。

        ◆停頓(Quiescing)--A process of bringing the on‐disk data of a physical or virtual computer into a state suitable for backups. This process might include such operations such as flushing dirty buffers from the operating systemʹs in‐memory cache to disk, or other higher‐level application‐specific tasks.

        ◆VCB代理(VCB proxy)--在〈VMware Consolidated Backup〉中,VCB代理是一個運行在物理機或者虛擬機的Microsoft Windows 2003,加固備份和第三方備份軟件。使用于執行文件等級和鏡像登記的虛擬機備份。

     

    備份什麽

        在ESX Server的環境裏,你需要備份以下主要的項目:

        ◆虛擬機内容(Virtual machine contents)--虛擬機數據的備份包括虛擬磁盤或者Raw Device Mappings (RDMs),配置文件,等等。

        類似有些虛擬機,你必須週期性地備份虛擬機的數據,防止由於人爲或者技術上潛在的損害和丟失。

        一般,為你的虛擬機使用以下的備份進度表:

            ◆鏡像等級,週期性地為Windows和每夜地為Linux執行備份。舉例:每星期備份一次Windows虛擬機的啓動磁盤鏡像。

            ◆文件等級,每天執行一次備份任務。舉例,每天晚上執行備份D,E等等分區上的文件。

        ◆Service Console (ESX Server 3 only)--服務控制臺,一種定制版本的LINUX,是ESX SERVER3上命令行的管理界面。他為直接管理ESX Server3提供了工具和命令提示符。使用VI Clint是ESX Server 3主機主要的界面,使用Service Console只是提供高級的管理操作。

     

    虛擬機目錄

        儲存虛擬機,ESX Server使用了VMware Virtual Machine File System (VMFS).VMFS是物理磁盤或者LUNs存儲能力上的巨大文件,高性能文件系統。例如ESX Server的虛擬機的虛擬磁盤鏡像,或者虛擬機暫時的内存鏡像。

        自從ESX Server3.0開始,VMFS3支持目錄。也就代表,VMFS上一個分離的子目錄被使用于每個虛擬機。這個目錄包括虛擬機組成所有的文件,類似.vmdk虛擬磁盤文件,虛擬機配置.vmx文件,log文件,等等。

        An alternative to a virtual disk is a raw device mapping (RDM) that connects your virtual machine to a raw SAN LUN. RDMs can exist in two modes, virtual compatibility and physical compatibility.

     

    訪問和管理虛擬磁盤文件

        代表性的,你可以使用VMware Infrastructure Client (VI Client)在虛擬機上執行多樣性的操作。

        直接操作VMFS上虛擬磁盤文件可能通過服務控制臺(ESX Server 3),和命令行界面(ESX Server 3i),儘管使用VI Cliemnt是首選的方式。

        從服務控制臺或者遠程命令行界面,你可以使用類似“ls”或者“cp”查看和控制/vmfs/volumes目錄下的文件。

        額外的文件操作是通過vmkfstools命令行去激活。使用命令行去執行以下的操作。

        Creating, extending, and deleting disk images.
        Importing, exporting, and renaming disk images.
        Setting and querying properties of disk images.
        Creating and extending a VMFS file system.

     

    備份的組成和途徑

        儅你執行備份,在過程中以下備份軟件的三個成分會被涉及到:

        Backup Client (Backup Agent).一個可以掃描虛擬機文件系統和遷移被備份的數據到備份服務器的軟件。在恢復的操作,Backup Client將數據寫道文件系統中。

        Backup Server.被backup client所推動,作爲備份中介,寫入數據的程序。在還原的操作,backup server從備份中介讀取數據,和推動他到backup client。

        Scheduler.允許你有規律的安排備份工作和等同他們執行的程序。

    Each of the backup software components can be run in a virtual machine, on the service console (only with ESX Server 3), or on a VCB proxy running Microsoft Windows 2003. While the location of the scheduler is not important, the locations of the backup server and backup client are important.

        依賴于在什麽地方你需要運行哪些組成構件,選擇以下其中一個途徑:

        Traditional backup approach. You deploy a backup client to every system that requires backup services. You can then regularly schedule automatic backups.With this approach, several methodologies exist. Choose a method that better suitsyour needs and requirements.

        VMware Consolidated Backup. If used with SAN storage, Consolidated Backup enables offloaded and impact‐free backups for virtual machines running on ESX Server. This approach lets you use the virtual machine snapshot technology and SAN‐based data transfer in conjunction with traditional file‐based backup software. When running Consolidated Backup, you can back up virtual machine contents from a centralized Microsoft Windows 2003 backup proxy rather than directly from the ESX Server system. Utilizing a backup proxy reduces the load on ESX Server allowing it to run more virtual machines.If you do not have SAN, you can use Consolidated Backup in the LAN mode. This mode lets you run Consolidated Backup on a physical machine connected to your ESX Server system over regular TCP/IP network, or in one of the virtual machines on your ESX Server host.(翻譯好累,這兩段大家意會吧

    使用傳統的備份模式

        使用傳統的備份模式,你可以在各自數據需要保護的主機上展開一個備份的代理。規則化的備份是被自動化的管理。

        The backup agent scans the file system for changes during periods of low system utilization and sends the changed information across the network to a backup server that writes the data to a backup medium, such as a robotic tape library.

        使用傳統式的備份方式,當你使用ESX Server 3和 service console的時候,你可以備份你的虛擬機。

    傳統式備份的考慮

        當你使用傳統備份模式去備份你的系統的時候,留意以下幾點;

        To be able to capture the data in its consistent state, perform backups at the times of the lowest activity on the network and when your computer resources are mostly idle. While performing backups, you might need to take critical applications off line.
        Make sure that network bandwidth between the server you are backing up and the backup server is sufficient.
        With a large number of servers, both physical and virtual, allocate enough resources to manage backup software on each host. Managing agents in every virtual machine is time consuming.

    Backing Up the ESX Server 3 Service Console

        Because the ESX Server 3 service console does not experience major changes during its lifetime and its state is easily recoverable in case of a failure, you might decide against backing it up. If you choose to back up the service console, you do not need to do it frequently.

        Use the following methods when backing up service console:

        基於文件(File‐Based.)Treat the service console as a physical machine with a deployed backup agent. To restore the service console, reinstall it, reinstall the agent, and then restore the files that you backed up. This approach makes sense if management agents that are hard to set up have been deployed in the service console. Otherwise, this approach provides no advantage over not backing up the service console.

        基於鏡像(Image‐Based.)Use third‐party software to create a backup image that you can restore quickly. Use your boot CD or whatever the backup software created to restore the service console.

    Backing Up Virtual Machines

        依賴于你的需求和可用性的資源,你可能選擇一個傳統式方法去備份你的虛擬機。傳統式的備份方法無法使用加固備份(Consolidated Backup.)

        傳統式的備份方式提佛以下的操作:

        在虛擬機裏運行備份客戶端,和執行“文件等級”或者“鏡像等級”備份。只要你是通過網絡備份,不需要兼容性支持。

        在ESX Server 3 service console下運行備份客戶端,備份VMFS文件系統中虛擬機的所有文件。

        備份虛擬機數據通過在虛擬機内運行一個backup server,連接到磁帶驅動器或者其它基於SCSI的備份媒體,把它們放在物理系統上。

        當虛擬機文件放在共享存儲,使用在存儲上類似SAN,NAS,或者iSCSI或者一個獨立的備份服務器去執行基於存儲的鏡像的方式去備份虛擬機。

     

    虛擬機中運行備份客戶端

        因爲虛擬機其實也是一個“物理機”,你可以備份他使用同樣的習慣方式就類似一個物理機,在虛擬機内使用備份的軟件。

        以下方法一和方法二舉例説明,你如何在每一個虛擬機内安裝備份代理,和通過網絡備份數據和備份服務器,展開所有其他的虛擬機或者在物理機内。

    方法一:在虛擬機内備份服務器

        使用這種方法,展開你備份客戶端在其中一個虛擬機當備份的服務器在其他的虛擬機上。VMware推薦你運行虛擬機在同樣的ESX Server系統。這樣子,數據通過這兩個虛擬機移動通過虛擬以太網連接到這些虛擬機,但是不需要將數據轉移通過物理的以太網連接上。

        當你使用方法一時,備份代理會執行停頓當虛擬機被備份完畢后。

        方法一普遍的被使用在虛擬機磁盤鏡像裏執行文件等級備份數據存儲。

    Table 1-1. Backup Client in One Virtual Machine, Backup Server in Another Virtual
    Machine
    Recommended:
    When hardware for a VCB proxy or backup server isn’t available
    File-level restore: Very easy
    Full virtual machine restore: No
    Quiescing: Excellent
    Load on ESX Server: Extremely high
    LAN-free backup: No
    Manageability: Very poor

     

    方法二:備份服務器在物理機

        使用方法二,你展開備份客戶端在虛擬機内當備份服務器運行在服務器上時。

        使用方法二因爲數據存儲的文件等級備份在虛擬機的磁盤鏡像裏面。

     

    Table 1-2. Backup Client in a Virtual Machine, Backup Server in a Physical Machine
    Recommended: VCB can be used instead
    File-level restore:Very Easy
    Full virtual machine restore: No
    Quiescing:Excellent
    Load on ESX Server: High
    LAN-free backup: No
    Manageability: Very poor

     

    Running the Backup Client in the ESX Server 3 Service Console

        因爲一個完整的虛擬機被壓縮在少數量的文件内,你可以把虛擬機看作是ESX Server3主機内的文件,和從服務器控制臺備份這些文件。通過方法三和方法四舉例説明,通過這些步驟,你可以在你的服務控制臺展開備份客戶端,以備份這些文件達到備份服務器的目的,在其他服務器或者物理機种展開。

        當你在服務控制臺中運行備份客戶端,執行以下其中之一去備份你的虛擬機:

        關閉虛擬機電源

        使用快照去備份正在運行中的虛擬機

     

    方法三:備份服務器在一虛擬機内

         使用方法三,你展開備份客戶端在一ESX Server 3的服務控制臺當備份服務器運行在虛擬機种時。

        方法三倍使用于執行鏡像等級備份或者整個虛擬機的備份

        Table 1-3. Backup Client in a ESX Server 3 Service Console, Backup Client in a Virtual Machine
        Recommended: When hardware for a VCB proxy or backup server isn’t available
        File-level restore: No
         Full virtual machine restore: Very easy
         Quiescing: Excellent
         Load on ESX Server: Extremely high
       LAN-free backup: No
       Manageability: Very poor

     

    Method 4: Backup Server in a Physical Machine
        使用方法四,你展開備份客戶端在ESX Server 3的服務控制臺黨備份服務器運行在物理機器時。

        方法四倍使用在執行鏡像登記備份。

        Table 1-4. Backup Client in an ESX Server 3 Service Console, Backup Server in a Physical Machine
        Recommended:VCB can be used instead.
        File-level restore: No
        Full virtual machine restore: Very Easy
        Quiescing:Excellent
        Load on ESX Server: High
      LAN-free backup: No
       Manageability: Very poor

     

    Running the Backup Server in a Virtual Machine

        你可以備份虛擬機數據通過在一臺虛擬機裏面運行一個備份服務器,連接到磁帶驅動器位,或者其他基於SCSI附屬在物理系統的備份媒體。

        使用這種方法,留意一下幾點:

        VMware supports attaching SCSI drives to the ESX Server using Adaptec SCSI adapters. Using other adapters, such as LSI MPT‐Fusion SCSI, is not supported.
        If you are using a tape drive library (versus using a stand‐alone tape drive), the library must be multitarget, and not multi‐LUN.
        Set the tape drive’s virtual target ID in the virtual machine’s configuration to be the same as the physical target ID.

     

    Treating Virtual Machines as Files on Shared Storage

        When virtual machine files reside on shared storage, it is possible to use storage‐based imaging on storage such as SAN, NAS, or iSCSI, or an independent backup server (a proxy backup server or NDMP) to back up virtual machine files without creating an additional load on the ESX Server host that runs the virtual machines.

    SAN Backups

        If your virtual disk files are stored on a SAN, use features supplied by your SAN vendor to create a copy of your production LUN containing all virtual disk files and then send these copies to your backup media. With this method, you do not have to use virtual machine snapshot functionality during the backup process because the SAN hardware
    provides the snapshot functionality.

        使用SAN的快照去備份你的數據時,注意以下幾點:

        很多產商為VMFS和RDMs支持快照。如果他們兩者都支持,你可以為你的主機選擇其中之一給他裏面整個虛擬機文件系統進行快照,或者為他們單獨的虛擬機做快照。

        一些廠商只為使用RDMs設置的進行快照。如果只有DRMs支持快照,那麽你可以單獨地為虛擬機做快照。

    NFS Backups

        如果你的虛擬機被存儲在額外使用NFS協議的網絡存儲系統上,你為虛擬機可以執行鏡像等級備份。

     

    Using VMware Consolidated Backup

    Reduce the load on your ESX Server systems by moving the backup tasks to one or more dedicated backup proxies.

    Eliminate the need for a backup window by moving to a snapshot‐based backup approach.
    Simplify backup administration by making optional the deployment of backup agents in each virtual machine you back up.
    Back up virtual machines regardless of their power state.

     

    關於Using VMware Consolidated Backup,下一章節開始持續三個章節,作詳細的講解,包括備份,還原,Troubleshooting等等,請關注。

     

    copyleft(r)Kt.Cheong

    March 07

    谈论 VM 热备份的几种办法 (更新完毕) - VMWARE企业高级应用 - 中国VMWARE - 中国虚拟化先锋

     

    引用

    VM 热备份的几种办法 (更新完毕) - VMWARE企业高级应用 - 中国VMWARE - 中国虚拟化先锋
    VM 热备份有几种方式: 1) 利用CONVERTER, 或第三方工具, 如 Platespin, Vizioncore 的产品等. 2) 在VCB PROXY服务器上通过VCB来热备, 3) 或是在ESX的SERVICE CONSOLE上通过vcbMounter或vmware-cmd工具来完成. 这里主要说说第3种, 也是ESX管理中最常用的.

    1. vcbMounter是ESX3附带的VM备份工具. 它可以对运行中的VM进行热备份, 后备的内容包括盘数据, 内存数据和VM的配置数据等. vcbMounter后备产生的IMAGE可用做VM的备份及灾后复原. 一个典型的vcbMounter例子:

    >vcbMounter -h esxhost -u backupuser -p password -a ipaddr:192.168.10.1 -r /vmfs/volumes/SAN1/vm-backups/vm1

    -h: 指定执行命令的ESX HOST 或 VIRTUAL CENTER.
    -u: 执行命令的帐户, 如果-h指定的是ESX, 要用该ESX上的帐户, 如果是VC, 则要用VC上的帐户...