Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Thanks ! How do I determine a given path is virtual ? In this case, /sys/devices/... ? Commented Dec 8, 2021 at 15:28
  • I think, in general, you can't, because there's a potentially infinite amount of file systems, and there's no clear distinction what is a "virtual" and a "normal" file system (is overlayfs virtual? What about tmpfs? How is a bind mount counted?…). But if you want to know on a "normal" system, you just check what mount a path is under, and check whether the file system there is among the "well-known" "regular storage" file systems (ext2/3/4, xfs, btrfs, reiserfs, zfs, vfat, exfat, ntfs, hfs, nfs, cifs, squashfs, iso9669, …). Commented Dec 8, 2021 at 15:47
  • generally, even more, your question is "how can I make sure I can create a file on a file system": and guess what, you can't create a file on a read-only file system, even if it's 100% backed by a storage device, and you can't create a file on a file system where you don't have permission to do so, or on a network filesystem if the server doesn't feel like it today, and you can't create a file on a file system that's full, and you can't create a file on a file system if SELinux decides that you're a rogue process, and … so, "virtual" is really not your problem. Just check whether you can. Commented Dec 8, 2021 at 15:49
  • 1
    @Veverke you need to determine what the closest mount point is, and then the corresponding file system type, and look it up in /proc/filesystems. If the relevant line in /proc/filesystems says nodev, then it is a virtual file system. Some virtual file systems do allow arbitrary storage (e.g. tmpfs and network file systems) but most don’t. Commented Dec 8, 2021 at 15:55
  • Let me rephrase that slightly; nodev means it doesn’t have a local backing device, so it’s either a network file system, a RAM-base file system, or some sort of virtual file system. Commented Dec 8, 2021 at 18:31