Without appropriate answer, I have to try for myself, and finally get the answer to my own question.
The answer is YES, dd command could be used to backup/restore the entire system (so can replace
nandroid part of ClockWorkMod).
You need to know the mapping of the partitions for the Desire HD:
Code:
/dev/block/mmcblk0p21 recovery
/dev/block/mmcblk0p22 boot
/dev/block/mmcblk0p25 system
/dev/block/mmcblk0p26 data
/dev/block/mmcblk0p27 cache
The partitions backupped will result in same size each time, with same backup/restore time
since it is a "raw" backup (bit-to-bit copy, or sector-by-sector copy in hard disk terminology).
I use the .dsk for file extension to avoid confusion with .img extension used by CWM (since they
are not the same format, and cannot be used in fastboot command for example).
Backup sample log:
Code:
ls -l /sdcard/MyBackups/recovery/recovery*.dsk
-rwxrwxrwx 1 root root 8909824 Jun 16 10:17 /sdcard/MyBackups/recovery/recovery_3.0.2.8.dsk
2011-06-17-02:26:24 Backup boot...
512+0 records in
512+0 records out
4194304 bytes (4.0MB) copied, 0.208129 seconds, 19.2MB/s
-rwxrwxrwx 1 root root 4194304 Jun 17 02:26 /sdcard/MyBackups/LeeDroid_Froyo/boot.dsk
2011-06-17-02:26:24 Backup system...
71423+1 records in
71423+1 records out
585104896 bytes (558.0MB) copied, 188.697998 seconds, 3.0MB/s
-rwxrwxrwx 1 root root 585104896 Jun 17 02:29 /sdcard/MyBackups/LeeDroid_Froyo/system.dsk
2011-06-17-02:29:33 Backup data...
150399+1 records in
150399+1 records out
1232076288 bytes (1.1GB) copied, 370.469513 seconds, 3.2MB/s
-rwxrwxrwx 1 root root 1232076288 Jun 17 02:35 /sdcard/MyBackups/LeeDroid_Froyo/data.dsk
2011-06-17-02:35:43 Backup cache...
38399+1 records in
38399+1 records out
314572288 bytes (300.0MB) copied, 97.289337 seconds, 3.1MB/s
-rwxrwxrwx 1 root root 314572288 Jun 17 02:37 /sdcard/MyBackups/LeeDroid_Froyo/cache.dsk
2011-06-17-02:37:21 Done.
Restore sample code:
Code:
ls -l /sdcard/MyBackups/recovery/recovery*.dsk
-rwxrwxrwx 1 root root 8909824 Jun 16 10:17 /sdcard/MyBackups/recovery/recovery_3.0.2.8.dsk
2011-06-17-15:28:33 Restore boot...
-rwxrwxrwx 1 root root 4194304 Jun 17 14:58 /sdcard/MyBackups/LeeDroid_Froyo/boot.dsk
512+0 records in
512+0 records out
4194304 bytes (4.0MB) copied, 1.006897 seconds, 4.0MB/s
2011-06-17-15:28:34 Restore system...
-rwxrwxrwx 1 root root 585104896 Jun 17 15:02 /sdcard/MyBackups/LeeDroid_Froyo/system.dsk
71423+1 records in
71423+1 records out
585104896 bytes (558.0MB) copied, 405.526398 seconds, 1.4MB/s
2011-06-17-15:35:20 Restore data...
-rwxrwxrwx 1 root root 1232076288 Jun 17 15:08 /sdcard/MyBackups/LeeDroid_Froyo/data.dsk
150399+1 records in
150399+1 records out
1232076288 bytes (1.1GB) copied, 434.877655 seconds, 2.7MB/s
2011-06-17-15:42:34 Restore cache...
-rwxrwxrwx 1 root root 314572288 Jun 17 15:09 /sdcard/MyBackups/LeeDroid_Froyo/cache.dsk
38399+1 records in
38399+1 records out
314568704 bytes (300.0MB) copied, 49.197021 seconds, 6.1MB/s
2011-06-17-15:43:24 Done.
Now with "dd" backup, I can now have the liberty to try other ROMs without my dreaded problem with CWM
.
Edit: let have a dream. How about using dd binary like nandroid currently invoked by CWM from it's menu?
CWM currently for backup or restore invoke the standalone nandroid binary with appropriate parameters, then it captures
(pipes) the output of e.g. tar utility to extract (restore) or compress (backup) the .img file.
With dd it would be simple to add to CWM menu to provide invocation of dd for a backup/restore using partition imaging method.
By doing this, no more need to plug an USB cable and use adb command.
Edit: Finally there is a simpler solution. Create an installation ZIP script (like the one used to flash ROM). Then in updater_script invoke a command (shell script, extension.sh) with the run_program(). You can provide parameters to this. You can have a zip to backup, a zip to restore etc...