I created a new partition on my server /dev/sda4 with a filesystem based on ext3.
I mounted the new partition /dev/sda4 on /mnt/sda4/ and created an image with dd of the partition /dev/sda3. sda3 is mounted on the root folder (cd /) so it contains the most important files.
Creation of the image:
dd if=/dev/sda3 of=/mnt/sda4/backup.img
Then I removed a file on /var/www/html/ which is on the partition sda3. I tried to restore the image and it worked, but the file which I removed earlier isn't in back in place.
dd if=/mnt/sda4/backup.img of=/dev/sda3
[root@h9999 sda4]# dd if=backup.img of=/dev/sda3 982128+0 records in 982128+0 records out 502849536 bytes (503 MB) copied, 1.13645 s, 442 MB/s
So actually it should work, shouldn't it?