doozan / NookManager

85 stars 13 forks source link

several backups, md5sum almost never the same #3

Closed Peterle closed 11 years ago

Peterle commented 11 years ago

It could be nice if we can do a couple of baks and see the same md5sum.

I tried 4 times and only few files have the same md5sum. Is there the possibility to achieve this important result so that we have the right answer that the backup is actually good and nothing has gone wrong?

I cannnot tell if the first 1.fat is good since it's different than the others....

Thanx

1 6f0d5840ebc17a320ca8b9b885bebf92 ./0.fat c957da33a0e50b17fb5c6814739424a5 ./1.fat 1dcebe345ce3115c822db198e8d2c4ae ./2.img af431a693ddf7923bf409c373de1da85 ./3.img cd8ebe6b0446668fea23d01da4790d75 ./4.fat de132e5f30ef1577c834188c9add7237 ./5.img 3cc7e631e54ddec0631f595de966d46d ./6.img 9d3ad80ab60db4ecca82fd02bfb52452 ./7

2 6f0d5840ebc17a320ca8b9b885bebf92 ./0.fat 7f0b712a001737e403457cea6e687edc ./1.fat cfbd9cf8463028bf2fa0de4e58341059 ./2.img b90d4d499eb8a90a271fbc2c7ea186b4 ./3.img a53fc0cd5b40e026a6bbac03838dcad0 ./4.fat 18984fa89b9568ff9a691ab5f003ca99 ./5.img f6b0d3eac623ab38d79d8226446b6605 ./6.img 9d3ad80ab60db4ecca82fd02bfb52452 ./7

3 6f0d5840ebc17a320ca8b9b885bebf92 ./0.fat 7f0b712a001737e403457cea6e687edc ./1.fat 57899dec0399e2d186e2a3b194765e2d ./2.img 210b952ef0369f83c23a68bcb71010ac ./3.img 182fff13349a612354086555dc99d69b ./4.fat d028bb4d858a5e9142f88f7ed3ea630c ./5.img c137d4618e9a1db51813fc91026550e9 ./6.img 9d3ad80ab60db4ecca82fd02bfb52452 ./7

4 6f0d5840ebc17a320ca8b9b885bebf92 ./0.fat 7f0b712a001737e403457cea6e687edc ./1.fat b7c0c488cec9341a2009ab502b492322 ./2.img 0bc1fe652431cfaea9b03791229b6612 ./3.img c1f40dbaf79e18ff13ad17d19a8eb714 ./4.fat fe2e3d972d2c10e86d84d5bc71d5224f ./5.img 89dcb6981ac5ef4c89e42f46c8742663 ./6.img 9d3ad80ab60db4ecca82fd02bfb52452 ./7

doozan commented 11 years ago

To save space on the compressed backup image, NookManager creates a file on each partition, writes it with zeros until the disk runs out of space, and then deletes the file. I suspect that the process of creating/deleting a file on the SSD alters the filesystem so that it is not an exact bitwise match to what it was before the file was created/deleted.

You can comment out the following lines in the create_backup script if you want to test this for yourself https://github.com/doozan/NookManager/blob/master/NookManager/scripts/create_backup#L14-L28

Peterle commented 11 years ago

I solved the issue by a triple (fresh) backup: after that I can surely root my nook with an increased sense of security.

  1. bak with nookmanager to benefit the zero-fill procedure in order to save space (and discard the bak)
  2. bak with the noogie image
  3. bak twice with the noogie image to verify that the md5sum is actually the same of the previous one, to be sure that nothing went wrong. Then I compress the image under 238.3MB (7zip)

I can swap nookmanager and noogie by a simple cut\paste drag and drop action of the files onto the first partition of the memcard (after an initial dd writing procedure that makes the memcard bootable). i've written here to complete the former comment.

filbo commented 10 years ago

FYI I just submitted a pull request (see issues/5) for various changes, one of which separates the zeroing and backing up steps. If you backed up twice without zeroing, sums would have a higher chance of being the same. I'm not sure if they would be the same, still. I know that with Linux filesystems, there are things like last-mount-time stamps in the superblock, which would change if the FS was ever mounted read/write, even if no files were changed. I don't think FAT filesystems have that, but if NookManager mounts any of the internal filesystems read/write and changes any files on them, sums would be different.

In particular, the zeroing is done by writing and then deleting a file. That file has a timestamp. Deleting a file on FAT doesn't wipe out all of its metadata, it just puts a zero byte at the beginning of the filename. Thus, each time you zero, you have at the very least written a new zero-file directory entry with a different timestamp.

filbo commented 10 years ago

I'm working on a Nook Simple Touch Glowlight (NSTG). I have very little on the internal filesystem. Most of my books are stored in Calibre on a computer and pushed into a microSD card in the NSTG. (I bought a few on BN; those are pushed down into the internal storage, but they don't add up to much.)

Pre-rooting backup takes about 5 minutes without zeroing, 15min with. Except that I'm testing on a device that I had already rooted once with NookManager, so it's possible that they're shipped filled with garbage? Seems unlikely. I will find out when I root one of my kids' NSTGs ... bwah hah hah...