2

According to the Debian installation manual, section 4.3, the hybrid installation ISO image can be easily copied on a USB key this way:

# cp debian.iso /dev/sdX
# sync

But according to my previous question about sync, it looks like it only works to flush file system buffers.

Then, why would sync work in the above command which does not involve a file system?

Totor
  • 20,040

1 Answers1

2

This is done as precaution. Since they have no way to know or force that all blocks are flushed by all OS, they prefer manually doing it. Also if you read the answer:

In any case, it doesn't matter. If what you are doing does not involve caching, then running sync (or some equivalent) anyway wouldn't be "inefficient": if there's nothing to sync, it's a trivial call.

(emphasis mine)

I would call the sync command just in case rather than not calling it at all. At least with sync I would be sure that everything will be alright.

Braiam
  • 35,991
  • I don't get it. Why don't they suggest something like blockdev --flushbufs /dev/sdX if sync "doesn't matter"? And how can you know that "what you are doing does not involve caching"? (or buffering for instance) – Totor Feb 21 '14 at 23:06
  • @Totor because how common is having blockdev vs. cp? They have to think about portability. Is more probable that people has cp and sync in their systems that blockdev. – Braiam Feb 21 '14 at 23:14
  • Ok, but if I get it, sync is useless anyway here, right? – Totor Feb 21 '14 at 23:19