linuxmint / linuxmint

Linux Mint
75 stars 9 forks source link

Incorrect writing of files to an NTFS flash drive, Linux Mint 21.2 Cinnamon #603

Open NorfLoud opened 1 year ago

NorfLoud commented 1 year ago

I have already faced such a problem several times that files written to a USB flash drive become unreadable or not working. I do the following: 1) connect an NTFS flash drive to a PC 2) I copy files to it (even text files, tables, executable files, installers, etc.) 3) I press the "disconnect device" button - sometimes there is no message that you can disconnect the device, but it itself has already disconnected judging by the explorer indicators 4) disconnect the device I connect this USB stick to another PC and find that the files are not readable and are not executed.

Jeremy7701 commented 1 year ago

If you copy any big files, USB sticks can take a long time to force data in buffers out to the device, due to the horribly slow write speeds on these things. Ejecting a stick doesn't happen until all data has been forced out.

NorfLoud commented 1 year ago

I have corrupted text files (.txt or .odt) less than 30 kB in size. Well, yes, I have the impression that it reports the completion of copying before it actually copied the file.

NorfLoud commented 1 year ago

Then why does the system inform me about the completion of the recording before the actual completion of the recording? This is an erroneous behavior of the system!

Jeremy7701 commented 1 year ago

Not a bug. The OS is in charge of the actual I/O to devices. Obviously USB isn't given any super priority, just because it is slow. Software Unmounts or ejects ensure that all data is forced out to the device and the file system is notified that the device can safely be removed.

NorfLoud commented 1 year ago

But then why is writing to a USB flash drive not correct? Why is there file corruption? If this happens, then there is erroneous behavior.

NorfLoud commented 1 year ago

How is this not a bug? I click the "unmount" flash drive icon after the file is recorded, the messages that it is possible to "safely remove the device" do not appear for tens of minutes, although I recorded a 2 kB text file.

Jeremy7701 commented 1 year ago

Check the drive is not mounted read-only. Have you tried more than one stick as the drive could be faulty? Does it make a difference if you use a stick with a different file system - such as FAT32?

NorfLoud commented 1 year ago

I tried several flash drives with FAT32 and NTFS. The problem is with NTFS flash drives. Files are copied to flash drives with FAT32 immediately. On flash drives with NTFS, recording is performed with a delay, because of this it is unclear at what point it can already be extracted from the PC. If the data on the NTFS flash drive were copied using the same algorithm as on the FAT32 flash drive, then there would be no problems.

fredcw commented 1 year ago

Try using umount command to see if reports any errors. You can get the device name from gnome "disks" app, eg. /dev/sdcor by using lsblk (which will also tell you what devices are mounted) Then use umount /dev/sdc

edit: btw, you can also use "Disks" app to unmount the drive and check that it's unmounted, this might help determine if the problem is with Nemo.