Despite a lot of Googling I couldn't find an answer to my problem.
I'm a Linux sysadmin and I want to backup a Windows XP installation (but it could be any other OS) located on the first partition of a 160 GB hard disk (which I have shrinked to its minimum size, about 4.8 GB), and the MBR, in the same file. The goal is to have a single disk image that I could use to overwrite a new hard disk (ex. dd if=/my/file.img of=/dev/sda) and use gparted to grow the partition to the new disk's full size afterwards, thus having an image as easy to use as the hybrid disk images Debian or Ubuntu release for their live systems (which you can write directly to USB sticks with dd, but I only want to use them on plain hard disks).
I already know how to backup/restore the MBR or a single partition with dd, but now I'd like to backup both in a single file.
I didn't try anything yet, but I thought of two methods :
Concatenate (with cat, for example) both the MBR and the partition image files into a single image file, but I'm not sure there's nothing between them in the original disk.
Use dd's "count" option to backup the hard disk until the end of the first partition, but then, I don't know how to calculate the correct size to end the copy at. Maybe the number of bytes copied when backing up the partition (which dd outputs when it has completed) with 512 bytes added for the MBR, but again, I don't know hard disks data structures deeply enough to be sure that there's not some data between them that I should add to the total.
Backing up the entire disk to a sparse or compressed file is not an option, since I'd like to be able to use this image on a disk smaller than the original one (but larger than the shrinked partition, of course).
Any advice would be appreciated, either a confirmation that the first method would (or wouldn't) work, a way to calculate the correct number for the 2nd method, or a completely different method to reach this goal, the only limitation being that, as a Linux user, I'd prefer a method using only basic software available on most Linux distributions, like dd or cat.