0

I am synchronizing data from my Sd card to my computer daily, actually wholse Sd card

A few days ago, Sd card got corrupted, I replaced it with a new & copied all data data back from Pc to new Sd card, but some of my files were corrupt

Here, I am confused that if I continue to synchronize my files this way and some files got corrupt on my Sd card, they will too get synchronized & I will have only corrupted files at both sides(Pc & Sd card), How can I prevent this type of scenario?

PS:

Sd card is being used in Android, FileSystem: FAT32

Pc Operating Sytem: Windows 7 x64 bit

I'm syncing wireless using FolderSync app for android (Local network synchronization)

And also use pc software FreeFileSync sometimes when I synchronize with data cable attached to pc(Again local synchronization only)

0

2 Answers 2

4

There are two ways to prevent this:

  • Run an integrity check on the SD card before synchronization, and compare hashes after synchronization. The integrity check depends on the kind of file system you use. You might also do a file based integrity check if the file format supports that.

  • Keep multiple copies of the SD card. This way you can always go back to an earlier date (before the corruption happened).

Option 1 would be the advisable option, if there is data corruption, you want to know about it as soon as possible.

6
  • But if I change a file, the file hash will get changed, And same will get happen if a file is corrupted, (means file hash will get changed upon file corruption too), then How could file hash synchronization can work without data corruption problem Commented Jan 18, 2018 at 14:36
  • @WaqarAslam - So check the checksum of the source file and compare it to the destination file. The simplest solution to prevent data loss from, data corruption, is to keep multiple copies. You can also use file systems that are less vulnerable to data corruption. FAT32 isn't one of them. There is a reason NTFS was developed.
    – Ramhound
    Commented Jan 18, 2018 at 14:37
  • Sd card NTFS partition was not being recognized by Android TWRP recovery and byr some other mobiles, that's why I had to format it as FAT32 Commented Jan 18, 2018 at 14:42
  • I was also thinking that maybe I have to keep a seperate backup of my Sd Card, daily or weekly, i.e multiple copies if data, but then it will require a large or very large disk space on computer just for Sd Card backups Commented Jan 18, 2018 at 14:46
  • I would wonder why you are continuing to use SD card technology, it will fail, it is inevitable, it might be today, tomorrow, or sometime, but it will fail. Why not something more reliable, like cloud storage, that can be accessed from anywhere on any device?
    – acejavelin
    Commented Jan 18, 2018 at 15:05
0

This is not your case personally, of course, and won't work for Windows or Android, but it may well be useful to other users reading your publication.

There is open source software for Linux that solve exactly the issue you wrote about.

https://github.com/dennisrazumovsky/precizer

precizer is a CLI application designed to check up the integrity of files after synchronization. The program recursively traverses directories and creates a database of files and their checksums, followed by a quick comparison.

precizer is focused on work with gigantic file systems. With the program it is possible to find synchronization errors by comparing data with files and their checksums from different sources. Or it can be used to crawling historical changes by comparing databases from the same sources over different times.

SIMPLE EXAMPLE

Assuming there are two hosts with large disks and identical contents mounted in /mnt1 and /mnt2 accordingly. The general task is to check whether the content is absolutely identical or whether there are differences.

1.Run the program on the first machine with host name, for example “host1”:

precizer --progress /mnt1

As a result of the program running all directories starting from /mnt1 will be recursively traversed and the host1.db database will be created in the current directory. The --progress option visualizes progress and will show the amount of space and the number of files being examined.

2.Run the program on a second machine with a host name, for example host2:

precizer --progress /mnt2

As a result, the host2.db database will be created in the current directory.

3.Copy the files with the host1.db and host2.db databases to one of the machines and run the program with the appropriate parameters to compare the databases:

precizer --compare host1.db host2.db

The following information will be displayed on the screen:

  • Which files are missing on host1 but present on host2 and vice versa.
  • For which files, present on both hosts, the checksums do NOT match.
1
  • 2
    Explaining HOW this product will solve the problem and how to use it to do so will make this an answer. Currently, this is just a comment. Please edit the post to make the necessary improvements. Commented Mar 11 at 19:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .