Bug 67431 - RFE: swap: support calling 'mkswap' on uninitialized swap units
Summary: RFE: swap: support calling 'mkswap' on uninitialized swap units
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-28 08:49 UTC by Michał Górny
Modified: 2018-08-08 15:30 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Michał Górny 2013-07-28 08:49:50 UTC
I'm using two zram devices for swap. By design, those devices are created at boot and are uninitialized.

It would be great if systemd had a simple 'Initialize=' boolean that would enable calling 'mkswap' to initialize the swap space. Preferably, with an fstab option to enable it transparently.
Comment 1 Tom Gundersen 2013-08-06 14:59:52 UTC
If we do this, we should make sure to first check that the swap partition does not contain a valid filesystem. This stuff could probably also be used for the encrypted swap stuff in our crypttab generator.
Comment 2 Lennart Poettering 2013-09-12 17:34:28 UTC
This is really dangerous business...
Comment 3 Radek Podgorny 2014-07-01 23:57:09 UTC
agreed, this could really destroy (potentially important) data.
Comment 4 Lennart Poettering 2018-08-08 15:30:47 UTC
We nowadays have this in place. Simply add "x-systemd.makefs" to your fstab mount options (or if you use a .swap unit directly pull in and order it after systemd-makefs@$DEVICE.service).

Closing hence.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.