[Solved] Files copy instantly to flash drive, but appear to be empty

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
burtfaceman
Posts: 7
Joined: 2024-11-15 03:53
Has thanked: 3 times

[Solved] Files copy instantly to flash drive, but appear to be empty

#1 Post by burtfaceman »

On a Debian 12 installation with Plasma desktop, I'm having a weird problem copying files to USB flash drives. Copying a 1GB file it should take a few minutes, but it completes instantly and reportedly successfully. The copied file appears to be the same size as the source file, but when I try to open it, it appears to be empty or corrupt.

Specifically, I'm attempting to copy an iso file to a flash drive set up with Ventoy. The Ventoy partition is formatted with exFAT, and has 5 GB free. When I attempt to boot into the offending copied iso file, I get an error (something like "magic number is incorrect").

I've tried both terminal and Dolphin to copy the file, with the exact same result in both cases: the copy operation completes instantly and the copied file appears to be the same size as the source, but the copied file doesn't work. Adding to the weirdness: the checksum of the copied file is correct.

Workaround, and proof that the problem is not with the flash drive: a virtual machine running Windows is able to properly copy to the flash drive properly. As expected, the process to copy a >1GB iso file takes a few minutes to complete, and I am able to boot into the iso file via Ventoy.

Am I somehow unwittingly creating a symbolic link or something silly like that?

Please help! Thanks in advance!
Last edited by burtfaceman on 2025-02-02 17:56, edited 1 time in total.

User avatar
ruwolf
Posts: 940
Joined: 2008-02-18 05:04
Location: Banovce nad Bebravou
Has thanked: 95 times
Been thanked: 74 times

Re: Files copy instantly to flash drive, but appear to be empty

#2 Post by ruwolf »

Is there no option in file-manager as “Safely Remove Volume”?

User avatar
pbear
Posts: 557
Joined: 2023-08-27 15:05
Location: San Francisco
Has thanked: 2 times
Been thanked: 89 times

Re: Files copy instantly to flash drive, but appear to be empty

#3 Post by pbear »

Shot in the dark. Confirm exFAT support is installed: apt list --installed | grep exfat

Aki
Global Moderator
Global Moderator
Posts: 4259
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 124 times
Been thanked: 576 times

Re: Files copy instantly to flash drive, but appear to be empty

#4 Post by Aki »

Hello,
burtfaceman wrote: 2025-01-25 05:12 [..] I'm having a weird problem copying files to USB flash drives. Copying a 1GB file it should take a few minutes, but it completes instantly and reportedly successfully. The copied file appears to be the same size as the source file, but when I try to open it, it appears to be empty or corrupt.
[..]
This may be normal behaviour, i.e. using a Debian/GNU Linux console.

USB sticks are usually very slow. The operating system (Debian) uses RAM as a memory cache to buffer file transfers, i.e. file copying. So, from the user's point of view, the copy command is completed before the actual data is written to the USB flash drive, and the OS continues to copy data files in the background. You have to wait for the copy to complete before you can use the copied files. In a terminal, you can do this by running the command sync, which will keep the console idle until the transfer is complete. Otherwise, as @ruwolf suggested, the un-mounting features of desktop environment ("safely remove ..") will sync the file system on the USB stick for you.

--
note: discussion moved to "Beginners Questions" sub-forum.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

burtfaceman
Posts: 7
Joined: 2024-11-15 03:53
Has thanked: 3 times

Re: Files copy instantly to flash drive, but appear to be empty

#5 Post by burtfaceman »

Aki wrote: 2025-01-25 08:18 This may be normal behaviour, i.e. using a Debian/GNU Linux console.

USB sticks are usually very slow. The operating system (Debian) uses RAM as a memory cache to buffer file transfers, i.e. file copying. So, from the user's point of view, the copy command is completed before the actual data is written to the USB flash drive, and the OS continues to copy data files in the background. You have to wait for the copy to complete before you can use the copied files. In a terminal, you can do this by running the command sync, which will keep the console idle until the transfer is complete. Otherwise, as @ruwolf suggested, the un-mounting features of desktop environment ("safely remove ..") will sync the file system on the USB stick for you.
Ah, this was it, thanks! I'd have expected Plasma or any desktop environment would know whether a file copy was truly complete.

User avatar
RedGreen925
Posts: 185
Joined: 2024-05-16 02:56
Has thanked: 4 times
Been thanked: 36 times

Re: Files copy instantly to flash drive, but appear to be empty

#6 Post by RedGreen925 »

burtfaceman wrote: 2025-02-02 17:51 Ah, this was it, thanks! I'd have expected Plasma or any desktop environment would know whether a file copy was truly complete.
It does that is why you seeing the spinning circle when you eject the drive before it has completed the copy. Then once that is complete the spinning stops and the drive disappears from the places or devices whichever one it is it shows up in. I get to see this on more than a few occasions when getting to quick to try the eject triangle.. I agree it is stupid the way it does it with the quick dismissal of the dialog it does. More than few times I have tried to get the speed of copy like you can with internal drive with large files but I cannot even get the mouse there before the dialog is gone.

CwF
Global Moderator
Global Moderator
Posts: 3242
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 69 times
Been thanked: 286 times

Re: [Solved] Files copy instantly to flash drive, but appear to be empty

#7 Post by CwF »

Xfce has a ‘transfer in progress’ dialog that doesn't go away until it's actually done. Unfortunately the dialog size is hard coded so you do have to mouse up the size to see the transfer rate.
Mottainai

Post Reply