I have an SD card mounted by Lubuntu at /media/$USERNAME/COREELEC/
I need to copy a file from one directory to another and rename it. However if I check the md5sum
(or sha512sum
) after I unmount
it and mount it again, it's different.
- Why is the checksum different after mounting again the SD card?
- Is there anything I can do to make it be the same again?
Steps to reproduce it (assuming there is an SD card mounted already by the OS)
Copy the file and check the md5sum
for both the original and the copied files:
$ # copy the file from the original directory to the desired directory
$ cp /media/$USERNAME/COREELEC/device_trees/gxm_q201_3g.dtb /media/$USERNAME/COREELEC/dtb.img
$ # checksum of the original file
$ md5sum /media/$USERNAME/COREELEC/device_trees/gxm_q201_3g.dtb
fd97f3d36cbb53cbdd59b53603f45913 /media/$USERNAME/COREELEC/device_trees/gxm_q201_3g.dtb
$ # checksum of the file I copied
$ md5sum /media/$USERNAME/COREELEC/dtb.img
fd97f3d36cbb53cbdd59b53603f45913 /media/$USERNAME/COREELEC/dtb.img
Unmount the SD card
$ # check which drive to unmount
$ df -aTh | grep COREELEC
/dev/mmcblk0p1 vfat 512M 170M 343M 34% /media/$USERNAME/COREELEC
$ # unmount the SD card
$ umount /dev/mmcblk0p1
Unplug the SD card by hand and plug it again by hand waiting for the Operating System to automatically mount it.
Then check the md5sum
(see now the checksum is different):
$ # checksum of the copied file (NOW DIFFERENT!)
$ md5sum /media/$USERNAME/COREELEC/dtb.img
c8e06c372926719c0a0dac2d5b0f6ab5 /media/$USERNAME/COREELEC/dtb.img
$ # checksum of the original file (STILL THE SAME!)
$ md5sum /media/$USERNAME/COREELEC/device_trees/gxm_q201_3g.dtb
fd97f3d36cbb53cbdd59b53603f45913 /media/$USERNAME/COREELEC/device_trees/gxm_q201_3g.dtb