public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* fstab zram swap integration idea
@ 2013-01-06  0:17 Maksim Melnikau
  2013-01-07 12:42 ` Karel Zak
  0 siblings, 1 reply; 4+ messages in thread
From: Maksim Melnikau @ 2013-01-06  0:17 UTC (permalink / raw)
  To: util-linux

Linux kernel now have interesting zram feature, which I would like to
initialize via fstab. May be you find it interesting, and this feature
will be implemented:

It will be nice, add to fstab option "mkswap before swapon", which
could be used for auto-initialization swap in zram.

Right now, I do it in next way, which isn't very nice I think:
1. zram size initialized via tmpfiles systemd mechanism
2. mkswap done via udev rule
3. /dev/zram0 added to fstab

I asked same question at systemd-devel ML, and was redirected to
util-linux http://lists.freedesktop.org/archives/systemd-devel/2012-November/007444.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fstab zram swap integration idea
  2013-01-06  0:17 fstab zram swap integration idea Maksim Melnikau
@ 2013-01-07 12:42 ` Karel Zak
  2013-01-07 14:52   ` Maksim Melnikau
  0 siblings, 1 reply; 4+ messages in thread
From: Karel Zak @ 2013-01-07 12:42 UTC (permalink / raw)
  To: Maksim Melnikau; +Cc: util-linux

On Sun, Jan 06, 2013 at 03:17:52AM +0300, Maksim Melnikau wrote:
> Linux kernel now have interesting zram feature, which I would like to

 hmm... why this all is not completely hidden in kernel memory
 management? Why we need re-route by special device?

 Is it designed for anything other than swaparea?

> initialize via fstab. May be you find it interesting, and this feature
> will be implemented:
> 
> It will be nice, add to fstab option "mkswap before swapon", which
> could be used for auto-initialization swap in zram.

 swapon(8) already contains swap area reinitialization code (exec
 mkswap), it's used for --fixpgsz.

 Maybe we can add "mkswap" fstab and command line option for swapon.
 Anyway, mkswap is a nice and quick way how to lost data if you make a
 typo in your configuration.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fstab zram swap integration idea
  2013-01-07 12:42 ` Karel Zak
@ 2013-01-07 14:52   ` Maksim Melnikau
  2013-01-10  9:47     ` Karel Zak
  0 siblings, 1 reply; 4+ messages in thread
From: Maksim Melnikau @ 2013-01-07 14:52 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Mon, Jan 7, 2013 at 3:42 PM, Karel Zak <kzak@redhat.com> wrote:
>  Is it designed for anything other than swaparea?
Yes, zram is kind-of "compressed" block device in memory, any block
device operations could be done on top of it. Some people initialize
ext4 partitions "in memory" for temporary operations.
So, I still think fstab is correct place for describing fs/swap even
for zram. Questions are: 1) what is correct place for mkfs/mkswap zram
devices, at startup? 2) What is correct place for setting size for
zram block device? (right now I use systemd's tmpfiles.d)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fstab zram swap integration idea
  2013-01-07 14:52   ` Maksim Melnikau
@ 2013-01-10  9:47     ` Karel Zak
  0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2013-01-10  9:47 UTC (permalink / raw)
  To: Maksim Melnikau; +Cc: util-linux

On Mon, Jan 07, 2013 at 05:52:28PM +0300, Maksim Melnikau wrote:
> On Mon, Jan 7, 2013 at 3:42 PM, Karel Zak <kzak@redhat.com> wrote:
> >  Is it designed for anything other than swaparea?
> Yes, zram is kind-of "compressed" block device in memory, any block
> device operations could be done on top of it. Some people initialize
> ext4 partitions "in memory" for temporary operations.
> So, I still think fstab is correct place for describing fs/swap even
> for zram. Questions are: 1) what is correct place for mkfs/mkswap zram
> devices, at startup? 2) What is correct place for setting size for
> zram block device? (right now I use systemd's tmpfiles.d)

I see two independent operations

  1/ initialize zram device
  2/ create on-device filesystem/swap

in our previous emails we have talked about 2/ for swap (call mkswap).

I'm not sure if 1/ belongs to swapon/mount. It seems better to create
a special udev rule for this purpose (we use the same solution for
example for raw devices) or systemd unit.

Note that the ideal solution is to have a special daemon for block
devices management where you can configure complex scenarios and ask
for usable device/filesystem.... but something like this is not
implemented yet. These things are too complicated to hide it into
mount/swapon.

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-10  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-06  0:17 fstab zram swap integration idea Maksim Melnikau
2013-01-07 12:42 ` Karel Zak
2013-01-07 14:52   ` Maksim Melnikau
2013-01-10  9:47     ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox