VMware Cloud Community
tomtan76
Contributor
Contributor

rsync a file from one esxi server to another

I have two esxi 3.5 servers with no shared drives.

i want to be able to mv VMs from the first server's local drive

to the second server's local drive with rsync.

both server have sshd turned on, and both have a statically built rsync in /bin.

I am currently able to rsync files to and from a third linux server.

But when i try to rsync straight between the two esxi server, rsync complains there is no ssh...

is there an ssh (client) binary that i can install on my esxi server?

Thanx

0 Kudos
25 Replies
lamw
Community Manager
Community Manager

ESXi does have a minimal SSH client/server called dropbear which can be used

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
BerndStoltefuss
Contributor
Contributor

Hi,

rsyncing 2 esxi servers can be done quiet easily.

Just download a rsync binary for esxi (basically a rhel 3 binary with acl/xattr turned off). You can get mine here:

Put the files to a persistent place inside esxi (like /vmfs/volumes/datastore1/tools). Otherwise they don't survive reboot(or you need to modify your oem.tgz).

In order to rsync to work in "daemon mode" (so you don't depend on slow ssh) you have edit /etc/inetd.like this:

rsync stream tcp nowait root /vmfs/volumes/datastore1/tools/rsync rsync --daemon --log-file=/tmp/rsync.log --config=/vmfs/volumes/datastore1/tools/rsyncd.conf -vv

Then do:

ps ax|grep inetd

kill -HUP <pid of inetd>

Important: you can't start rsync --daemon from a ssh shell. I has to be started by inetd. Otherwise you will get "getpeername" errors.

Bernd

0 Kudos
devzero
Expert
Expert

that`s really great news!

does it also work with esxi4 ?

does it run stable with esxi & inetd ?

0 Kudos
RParker
Immortal
Immortal

does it also work with esxi4 ?

does it run stable with esxi & inetd ?

Not sure, but this one does:

http://www.trilead.com/

0 Kudos
BerndStoltefuss
Contributor
Contributor

that`s really great news!

does it also work with esxi4 ?

does it run stable with esxi & inetd ?

Well, it runs stable for esxi 3.5i for me,-)

I don't think the binary will work with 4.0 as it is dynamically linked for 3.5 (RHEL3 based).

But you should be able to use one of the static rsync binaries in the forum as long as you use inetd to start it. (As i had getpeername problems with the static one's i did build a dynamically linked one but that was before i figured out that you have to run it from inetd to work. So the static one might work as well)

You may even compile your own binary. Just fetch rsync-src, install the linux which esxi4.0 is based on (i don't think it's still RHEL3) in a vm and compile rsync in this vm with (--with-included-pop --disable-acl-support --disable-xattr-support , as these libs are not available on esxi).

Regarding "trilead": it's a nice tool, but last time i had a look it was not able to do direct esxi to esxi backups. Has this changed?

Bernd

0 Kudos
devzero
Expert
Expert

>Well, it runs stable for esxi 3.5i for me,-)

ok, reading works.

but writing does NOT work at all for me - when writing to the rsync/inetd, no files are added to the target dir in /vmfs/..... and /tmp/rsyncd.log tells:

2009/06/15 18:16:40 name lookup failed for : ai_family not supported

2009/06/15 18:16:40 connect from UNKNOWN ()

0 Kudos
markus_schaefer
Contributor
Contributor

hi, i am facing the same problem...

compiled rsync 3.0.6 statically, tested the rsync binary (remote rsync daemon runs on bsd) -> no problem

then i tried to move a vm from one esxi to another esxi box which runs the rsync daemon via inetd without success.

It seems rsync daemon doesn't tell the rsync sender to start transfer.

Does it make sense to compile an strace statically capturing the process information on both machines (sender and receiver) and post it here?

0 Kudos
devzero
Expert
Expert

i tried to do that, but unfortunately the esxi console kernel does not seem to support ptrace().

is the esxi console kernel a linux kernel?

i tried to find out if it is a linux kernel, but vmware has stripped all things down so much that this seems very difficult.

if it is a linux kernel, in theory it`s the end users right to compile an esxi kernel from source and enable ptrace support, but that will be hard if not impossible.....

0 Kudos
DSTAVERT
Immortal
Immortal

The ESX and ESXi vmkernels are not linux. Not having looked at the EULA from a lawyers eye but I would doubt that the user had any right to modify the vmkernel

-- David -- VMware Communities Moderator
0 Kudos
DSTAVERT
Immortal
Immortal

For those who have used rsync do the drives mount or run. I can't imagine that the drive would be in any consistent state.

-- David -- VMware Communities Moderator
0 Kudos
mark_pryce
Contributor
Contributor

Enable SSH on ESXi

1.connect to console via ILO

2.hit alt-f1

3.type unsupported, you should see this screen or your PC has Java problem

4.login using the regular password

5.type vi /etc/inetd.conf

6.type /ssh

7.move cursor under # symbol and hit x on your keyboard to remove the #

8.type :wq and hit enter to save (if you make a mistake you can type :q! and it will exit without saving file)

9.type ps | grep inetd to get busybox pid

10.type kill -HUP 1307 (or another pid from step #9)

11.now you can ssh (putty)

0 Kudos
devzero
Expert
Expert

>The ESX and ESXi vmkernels are not linux.

so, if the ESX console kernel is not linux , what is it then ?

0 Kudos
devzero
Expert
Expert

>For those who have used rsync do the drives mount or run. I can't imagine that the drive would be in any consistent state.

could you please explain your statement? what`s wrong with rsync?

0 Kudos
DSTAVERT
Immortal
Immortal

I was asking a question of those who use rsync to move disks between ESXi hosts. Does the disk mount. I understand rsync. I just find it hard to believe that you would have a valid disk. A SQL server for instance.

-- David -- VMware Communities Moderator
0 Kudos
devzero
Expert
Expert

a virtual disk on esx/vmfs is a file. what does it matter (in terms of consistency, reliability) what tool you use for transfer from a to b ?

0 Kudos
DSTAVERT
Immortal
Immortal

These are just static VMDK files not active disks?

-- David -- VMware Communities Moderator
0 Kudos
devzero
Expert
Expert

afaik, active disks/vmdk files are locked on esx and cannot be accessed from the console os while being in use by a VM.

0 Kudos
DSTAVERT
Immortal
Immortal

I wasn't thinking of that at all even though I know it is true. I haven't used rsync from the esxi hosts. I use it all the time on linux for syncing files between locations. I am assuming you are transferring the vmdk and flat vmdks after a snapshot. Is the transfer just changed blocks?

-- David -- VMware Communities Moderator
0 Kudos
markus_schaefer
Contributor
Contributor

hi,

just to clarify this..currently the vm states are not important for syncing files between esxi hosts. This can be discussed later...

I just tried to sync a textfile between esxi hosts and even that transfer wasn't successfull.

@devzero have you statically compiled a process tracing binary and tested the transfer with that?

I thought the esxi hosts are based on RHEL3 and my static rsync is compiled on CentOS3.

The binary I compiled before was build on SUSE 10.3 and 11.1 but both binaries caused a segmentation fault on the esxi hosts.

@all does anyone successfully use rsync to transfer files between esxi hosts regardless of vm state (esxi 3.5 u4 rsync to rsync daemon)?

0 Kudos