How to create a disk image

So as some know there are some stock disk images floating on these forums that we can use when we need to debrick our drives. These images are about 300MB in a zip or about 5GB for the 2TB drive.

The images are in .img format.

My questios is how were these images created. Today i debricked my drive and installed some mods and stuff and now i would like to make a disk image myself so in case i need to de brick again, i can restore my image including my mods etc…

Earlier today i tried the disk utility in ubuntu to create an image but it seemed that it was going to create a 3TB .img file of my drive even it had no data on it…

DD seems to do the same thing.

Would anyone know how to make an image of a respectable size like the one i downloaded of these forums?

Thanks

You need to open the drive in disks in Linux and then make a disk image of the two 2GB raid partitions. Not sure if that would backup your kids as well though. I’ll try it later and see as I’ve just unbricked mine today and it’s still out of its case.

Once satisfied with your rootfs mods, find out which is the raid mount from the fstab then dump it elsewhere safe eg. in the DataVolume path:

dd if=`cat /etc/fstab|grep dev|awk '{print $1}'` of=/DataVolume/backup.img;

Results:

3999616+0 records in
3999616+0 records out
2047803392 bytes (2.0 GB) copied, 104.792 s, 19.5 MB/s

To restore, dump this backup.img instead of the original rootfs.img in both 2GB partition.

Hi nazar,

i had followed these steps to restore a stock img i had found on these forums:

http://community.wd.com/t5/WD-My-Cloud/Rebuild-your-My-Cloud-or-upgrade-the-HDD-on-it/td-p/675109

when i restore the .img in ubuntu, i think it over writes the whole disk if im not mistaken.

Are you saying that with your method, in case i brick my drive, i have the .img made according to your steps, i could simply use “dd” again to write my .img to the two raid partition and that will,

1- restore my disk’s rootfs

2- It will not over write the data partitions etc…

i had an old mybook live lying around so i wanted to test this out.

The fstab doesnt show the mount for the drive i plugged into the sata port of the PC.

cat /etc/fstab

/etc/fstab: static file system information.

Use ‘blkid’ to print the universally unique identifier for a

device; this may be used with UUID= as a more robust way to name devices

that works even if disks are added and removed. See fstab(5).

/ was on /dev/sda1 during installation

UUID=fce6e6cc-f7a3-4c4e-bd98-1500fd180276 / ext4 errors=remount-ro 0 1

swap was on /dev/sda5 during installation

UUID=55aaa278-f8e8-4cf1-be36-c0fcc8a42f77 none swap sw 0 0

So i proceeded to test wit ubtuntu’s disk uility. I selected one of the raid partition, created a disk image. it was 2GB.

Then i proceeded to intentionall break the mybook live drive by formatting those two raid partitions.

I then restored the partitions with the back.img. I realized that i had to manually specify the partition type i.e linux raid and that put the drive back to functioning state.

It should restore your rootfs, I tested quite sometime ago on previous firmware. But even it doesn’t, you still can loop mount the backup.img and manually retrieve your mods.

It will not write the data partition if you correctly dump it into both 2GB raid partitions. To play safe, make sure mdadm service doesn’t mount the raid paritions on your linux VM.