7

I'm looking for info about mounting a tmpfs partition and sync option. Sync makes the data beeing dumped onto the disk without beeing saved in cache. This works with ext4 and other filesystems. I'm wondering is even a tmpfs partition needs the sync option to be specified or it is enabled by default since it is a RAM partition. In my option it would be odd if a ramdisk would be cached in RAM.

tmpfs /tmp tmpfs defaults,sync,noatime,nosuid,nodev,noexec,mode=0777,size=400M 0 0

In a tmpfs partition is sync enabled by default?

  • 2
    tmpfs is not backed by any partition in the first place. – kasperd Jan 13 '19 at 15:56
  • exactly, let's change subject once again ;) – poige Jan 14 '19 at 11:05
7

I had to search a bit. According to

man mount

The sync option is relevant only for a limited number of filesystems, not for tmpfs.

So the answer is: It does not matter, since it is ignored by tmpfs.

6

Sync makes the data beeing dumped onto the disk without beeing saved in cache

"Standard" Linux manual states:

   sync   All I/O to the filesystem should be done synchronously.
          In the case of media with a limited number of write cycles
          (e.g. some flash drives),  sync may cause life-cycle shortening.

So it's not about cacheing but rather about durability. Writing synchronously doesn't mean there wouldn't be caching (for e. g., writethrough is well-known caching approach which is very different to writeback but both still are cacheing).

In my option it would be odd if a ramdisk would be cached in RAM.

As explained it doesn't prohibit cacheing but rather prohibits writeback-like behaviour. What would be odd is "durability" for RAM disk though.

  • 3
    It made a ton of sense on the 2.0 kernel ramdisk implementation, which actually did cache (I know crazy huh). – joshudson Jan 13 '19 at 19:07
  • probably you misread it. tmpfs isn't block device which RAM-disk is. Also it's not about cache – poige Jan 14 '19 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.