I have a RHEL5 Amazon cloud instance that I need to image to another instance in order to setup a test environment for some upcoming patching I'm doing. The server to be imaged is a production server.
The server has a single disk (xvda1, and yes the actual disk is xvda1, not xvda like it should be).
I thought I would use dd, piped to gzip, to make the image of the disk. But then I realized that there would be a problem with recursion. Because dd was reading from the disk that the gzip was being written to, the image would include a corrupted copy of the gzip file, meaning that the image itself was taking up more space than it needed to because of the partial copy of the gzip file, and thusly there would be more transfer time between the machines required.
Getting to the point, what options are there for backing up the entirety of the disk as a single block dump, the same way dd does, but that would not include the gzip file that is being written to on the same disk being read from?
Yes, I could rsync individual files, but for the purposes of this question, let's say that's not an option. Let's also say asking Amazon to add a second disk to the instance is not an option, nor are remote filesystems like NFS/SSHFS/etc, nor is LVM.
You want to create a block level backup to the very disk you are backing up...
With no network storage, and no additional local storage.
Of course this wont work, why are you trying to defy logic?
Right-click on the instance in the console, "create AMI". Check the "no reboot" box if you can't tolerate a few minutes of downtime while a snapshot is taken.
If it's an Amazon instance, adding a disk is always an option. Create an EBS instance and attach it.
The answer is to order additional memory for the cloud instance, and then make a ramdisk. Then dd your local disk to the ramdisk and do what you need to with the image to get it off of the server.