The zram-generator's documentation states,

If a mount point is not specified, the device will be initialized, but will not be used for anything.

Why would anyone want to initialize a swap file without mounting it?

  • How can a tool's purpose be opinion based? A hammer's purpose of hammering nails is in no way based on opinion.
    – Pound Hash
    Jan 25, 2022 at 5:40

1 Answer 1


Well, according to that code snippet, it isn't a swapfile it is a compressed file system.

As to why init it without mounting it, I can see mounting it later to copy files to, then unmount, then make an image, etc. of it. Just because it isn't automatically mounted doesn't mean you can't mount it later....

  • it's a compressed swap image, not a file system, but aside from that, you're spot on Dec 21, 2021 at 0:03
  • zram is actually a compressed block device and can be used with any format not only swap and @ivanivan is right, the example uses it with ext2 so in this case it is a compressed filesystem. Dec 21, 2021 at 6:37

Not the answer you're looking for? Browse other questions tagged .