[vmsbackup] The Basics

284 views
Skip to first unread message

Jamie Gadong

unread,
May 4, 2010, 12:03:53 PM5/4/10
to vmsbackup
Hi to all,

I am a bit of simpleton well at least I certainly feel like it. I have
read through the readme and the script itself and still can't get it
to run.

I am running Vmware Server 1 on Redhat 5 OS.

What are the absolute minimum changes I need to make to the script for
it to run. Bearing in mind LVM option is false and it is a cold
suspend backup.

Thanks to all that reply. If that is not clear enough please ask me a
question and I'll provide you any details required.

--
You received this message because you are subscribed to the Google Groups "vmsbackup" group.
To post to this group, send email to vmsb...@googlegroups.com.
To unsubscribe from this group, send email to vmsbackup+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/vmsbackup?hl=en.

Michele Pensotti

unread,
May 5, 2010, 4:56:54 AM5/5/10
to vmsb...@googlegroups.com
Hello Jamie and thanks for your interest in the script.

When I setup a new vmware 1.x host I do the following.

Copy the script and its config file into /root
Make them executable (if they are not already) with
chmod +x backup_vmware.sh
chmod +x backup_vmware.conf

Then I download and install lzop (I use that as a compressor since it's faster than gzip) with the following commands:

cd /usr/local/src
wget http://www.lzop.org/download/lzop-1.01-linux_i386.tar.gz
tar -zxvf lzop-1.01-linux_i386.tar.gz
cp lzop-1.01-linux_i386/lzop /usr/bin/lzop

Then I download and install sendEmail (since I want to receive notification emails with the result of the backup):


cd /usr/local/src
wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz
tar -zxvf sendEmail-v1.55.tar.gz
cp sendEmail-v1.55/sendEmail /usr/bin/sendEmail

After that I create a directory where to make the backups and mount my nas on it:

mkdir /mnt/openfiler-samba
and mount it to my openfiler's samba share
mount -t cifs -o user=myuser,password=mypassword //192.168.x.y/samba /mnt/openfiler-samba

Then I customize the backup_vmware.sh script with my custom parameters, specifically the following lines:

GUESTPATH="/var/lib/vmware/VirtualMachines"
BACKPATH="/mnt/openfiler-samba"

EMAILTO="mye...@mydomain.com"
EMAILFROM="$HOST <$HO...@mydomain.com>"
EMAILSRV="192.168.x.y"

And last but not least I enable my VMs for backup by running the script as follows:

cd /root
./backup_vmware.sh -ea

For example this will enable all my registered VMs for backup

Then check my settings by running the script with this options:

./backup_vmware.sh -D -c -s cold -f lzop

If all is ok I run the backup with the same command but removing the -c option (which forces the script to make a check and not to run the real backup)

./backup_vmware.sh -D -s cold -f lzop

You can then schedule the script with cron (remember to make it run it as root!)

Good luck with your backups!

Michele

----- Messaggio originale -----
> Da: Jamie Gadong <jamie....@googlemail.com>
> A: vmsbackup <vmsb...@googlegroups.com>
> Inviato: Mar 4 maggio 2010, 18:03:53
> Oggetto: [vmsbackup] The Basics
>
> Hi to all,

I am a bit of simpleton well at least I certainly feel like
> it. I have
read through the readme and the script itself and still can't get
> it
to run.

I am running Vmware Server 1 on Redhat 5 OS.

What
> are the absolute minimum changes I need to make to the script for
it to run.
> Bearing in mind LVM option is false and it is a cold
suspend
> backup.

Thanks to all that reply. If that is not clear enough please ask
> me a
question and I'll provide you any details required.

--
You
> received this message because you are subscribed to the Google Groups
> "vmsbackup" group.
To post to this group, send email to
> ymailto="mailto:vmsb...@googlegroups.com"
> href="mailto:vmsb...@googlegroups.com">vmsb...@googlegroups.com.
To
> unsubscribe from this group, send email to vmsbackup+
> ymailto="mailto:unsub...@googlegroups.com"
> href="mailto:unsub...@googlegroups.com">unsub...@googlegroups.com.
For
> more options, visit this group at
> href="http://groups.google.com/group/vmsbackup?hl=en" target=_blank
> >http://groups.google.com/group/vmsbackup?hl=en.

Jamie Gadong

unread,
May 5, 2010, 7:28:28 AM5/5/10
to vmsb...@googlegroups.com
Hi Michele,

Thanks for that! 

Works perfectly.

My next question would be recovering backups? I noticed that the files had been done in blocks. How do you recover the VM's from this format?

Thanks again!

Jamie.

Michele Pensotti

unread,
May 5, 2010, 8:57:56 AM5/5/10
to vmsb...@googlegroups.com
Hello again Jamie,

the solution is quite simple.

In the folder where the backups are created by the script there also are some files named "yourvmname"_instructions.txt in which are summarily described the steps to be done to do a recovery, but let me explain in more detail.

The VMs files are tarred and compressed , then they are split in files of (by default) 1490MB.
This "strange" size is to avoid potential problems with FAT filesystems which limit the maximum file size to 2048MB, and also to allow to completely fill (1490MB x 3 = 4470MB = 1 DVD) an entire single layer DVD, in case one has to burn the files to a DVD.

To recover from this kind of split-backup you ideally should re-merge the chunks and then uncompress and untar the resulting big file.
But this can be accomplished with one single command line:

cat /path_to_backup_files/"yourvmname".tar.lzo* | lzop -d | tar -xvf -

Please note that this command will recreate the VM folder and the files in it in the current path, so please cd to the desired restore path before running it!

So for example if your virtual machines directory is in /var/lib/vmware/VirtualMachines
and your shared folder with the backup files is in /mnt/openfiler-samba
then your restore commands will be:

cd /var/lib/vmware/VirtualMachines
cat /mnt/openfiler-samba/"yourvmname".tar.lzo* | lzop -d | tar -xvf -
then you open up your vmware server console and add the newly restored vm to the inventory and
perform a "resume" operation, in case you did a cold backup.
Instead, if you performed an hot backup, you will have to perform a "revert to snapshot" operation and will get the VM running as it was at the exact moment it was backed up.

Hope this helps

Live long and prosper,

Michele

Da: Jamie Gadong <jamie....@googlemail.com>
A: vmsb...@googlegroups.com
Inviato: Mer 5 maggio 2010, 13:28:28
Oggetto: Re: [vmsbackup] The Basics

Hi Michele,

Thanks for that! 

Works perfectly.

My next question would be recovering backups? I noticed that the files had been done in blocks. How do you recover the VM's from this format?

Thanks again!

Jamie.

Charles Tooraen

unread,
May 5, 2010, 9:13:11 AM5/5/10
to vmsb...@googlegroups.com
Michele,

how would these instructions differ with VMWare 2.x??

Best Regards,

Charles Tooraen
Operations Manager
NIC Law Enforcement Supply
www.nles.com
888-642-0007

Michele Pensotti

unread,
May 5, 2010, 10:51:15 AM5/5/10
to vmsb...@googlegroups.com
For VMware Server 2.x there are a couple more steps to do, as follows: (directly taken from INSTALL.TXT)

Please follow this procedure:

1. Add linux user 'vmbackup' with some password and '/bin/false' login shell
useradd vmbackup -s /bin/false
passwd vmbackup

2. In VI Web Access create Role 'Backup Script' with next privileges:
* Virtual Nachine -> Interaction -> Power On
* Virtual Nachine -> Interaction -> Power Off
* Virtual Nachine -> Interaction -> Suspend
* Virtual Nachine -> Interaction -> Console Interaction
* Virtual Nachine -> State -> Create Snapshot
* Virtual Nachine -> State -> Revert to Snapshot
* Virtual Nachine -> State -> Remove Snapshot
* Virtual Nachine -> State -> Rename Snapshot

3. In VI Web Access create new Permission which attaches system user 'vmbackup' to Role 'Backup Script'
4. Put 'vmware' user's credentials into this script.

In the script you need to customize the following variables:

VMUSER
VMPASS

Change VMUSER only if you chose another user name!
Change VMPASS to match the password you chose when you created the user in linux


And that's all!

Hope it helps

Michele


----- Messaggio originale -----
> Da: Charles Tooraen <cha...@nles.com>
> A: vmsb...@googlegroups.com
> Inviato: Mer 5 maggio 2010, 15:13:11
> Oggetto: Re: [vmsbackup] The Basics
>
> target=_blank
> >http://www.lzop.org/download/lzop-1.01-linux_i386.tar.gz
> tar -zxvf
> lzop-1.01-linux_i386.tar.gz
> cp lzop-1.01-linux_i386/lzop
> /usr/bin/lzop
>
> Then I download and install sendEmail (since I
> want to receive notification emails with the result of the
> backup):
>
>
> cd /usr/local/src
> wget
> href="http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz"
> target=_blank
> >http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz
>
> tar -zxvf sendEmail-v1.55.tar.gz
> cp sendEmail-v1.55/sendEmail
> /usr/bin/sendEmail
>
> After that I create a directory where to make
> the backups and mount my nas on it:
>
> mkdir
> /mnt/openfiler-samba
> and mount it to my openfiler's samba share
>
> mount -t cifs -o user=myuser,password=mypassword //192.168.x.y/samba
> /mnt/openfiler-samba
>
> Then I customize the backup_vmware.sh
> script with my custom parameters, specifically the following
> lines:
>
> GUESTPATH="/var/lib/vmware/VirtualMachines"
>
> BACKPATH="/mnt/openfiler-samba"
>
> EMAILTO="
> ymailto="mailto:mye...@mydomain.com"
> href="mailto:mye...@mydomain.com">mye...@mydomain.com"
>
> EMAILFROM="$HOST<$
> href="mailto:HO...@mydomain.com">HO...@mydomain.com>"
>
> EMAILSRV="192.168.x.y"
>
> And last but not least I enable my VMs
> for backup by running the script as follows:
>
> cd /root
>
> ./backup_vmware.sh -ea
>
> For example this will enable all my
> registered VMs for backup
>
> Then check my settings by running the
> script with this options:
>
> ./backup_vmware.sh -D -c -s cold
> -f lzop
>
> If all is ok I run the backup with the same command but
> removing the -c option (which forces the script to make a check and not to run
> the real backup)
>
> ./backup_vmware.sh -D -s cold -f
> lzop
>
> You can then schedule the script with cron (remember to
> make it run it as root!)
>
> Good luck with your
> backups!
>
> Michele
>
> ----- Messaggio originale
> -----
>
>> Da: Jamie Gadong<
> ymailto="mailto:jamie....@googlemail.com"
> href="mailto:jamie....@googlemail.com">jamie....@googlemail.com>
>>
> A: vmsbackup<
> href="mailto:vmsb...@googlegroups.com">vmsb...@googlegroups.com>
> href="mailto:vmsb...@googlegroups.com">vmsb...@googlegroups.com.
To
> unsubscribe from this group, send email to vmsbackup+
> ymailto="mailto:unsub...@googlegroups.com"
> href="mailto:unsub...@googlegroups.com">unsub...@googlegroups.com.
For
> more options, visit this group at

Charles Tooraen

unread,
May 5, 2010, 11:02:05 AM5/5/10
to vmsb...@googlegroups.com
ok so these instuctions are in addition to the 1.x instructions stated
previously in teh email.

Best Regards,

Charles Tooraen
Operations Manager
NIC Law Enforcement Supply
www.nles.com
888-642-0007


Reply all
Reply to author
Forward
0 new messages