Check whether all data is flushed to usb flash from command line

Josef Wolf jw at raven.inka.de
Fri Oct 6 12:36:13 UTC 2023


Hello,

what is the proper way to check whether all (low-level) data is flushed to usb
flash from command line?

Please note that this question is NOT about
- sync (flushing file system data)
- umount (implies sync)
- eject (implies umount)
because all those commands are about file system level.


When I do (for example):

$ sudo dd bs=10M status=progress if=ubuntu-22.04.2-live-server-amd64.iso of=/dev/sdX
$ sudo eject /dev/sdX

then there is low-level buffering under the hood.

At the moment I execute "eject", dmesg starts showing ugly things like:

 [178454.973055] blk_update_request: I/O error, dev sdb, sector 488570480 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0

and reading back confirms that writing the contents aborted at some point in
time.

So how do I know that all (low-level) data has been flushed to the disk and it
is safe to eject/unplug the usb drive?

-- 
Josef Wolf
jw at raven.inka.de



More information about the ubuntu-users mailing list