Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

writeback-device option #139

Closed
roland-5 opened this issue Dec 6, 2021 · 5 comments
Closed

writeback-device option #139

roland-5 opened this issue Dec 6, 2021 · 5 comments
Labels
question Further information is requested

Comments

@roland-5
Copy link

roland-5 commented Dec 6, 2021

I have a big problem with setting the writeback-device option correctly. I uncommented writeback-device = /dev/zvol/tarta-zoot/swap-writeback in /etc/systemd/zram-generator.conf and when I restart system, it's waiting 90s and failing to create/reach this file.

If I do cat /sys/block/zram0/backing_dev

none

I thought files in /dev are created by system when its start. In zram-generator.conf man is written

Takes a path to a block device, like /dev/disk/by-partuuid/2d54ffa0-01 or /dev/zvol/tarta-zoot/swap-writeback.

So I created block device with command

dd if=/dev/zero of=swap-writeback.img bs=200M count=10

in /, and created there file system mkfs.btrfs swap-writeback.img. But if I restart it still waiting 90s and crash.
How can I do this properly?

@keszybz
Copy link
Member

keszybz commented Dec 6, 2021

The device must exist… /dev/zvol/tarta-zoot/swap-writeback is a example path to a zfs volume that most likely doesn't exist on your system.

Also, this option does not support files. It must be a device.

Why are you trying to use this option?

@nabijaczleweli
Copy link
Collaborator

As the documentation clearly states: you can only write-back to a block device. Do you have a block device?
From what I can tell in your comment, you (a) set the write-back device to one that doesn't exist on system (I assume you don't name your pools in polish) and (b) made an unrelated two-gigabyte file on your rootfs.
If you really want to write-back to that file, use losetup(8); otherwise, cut a zvol or make a partition on one of your disks.

@nabijaczleweli nabijaczleweli added the question Further information is requested label Dec 6, 2021
@keszybz keszybz closed this as completed Dec 10, 2021
@lavilao
Copy link

lavilao commented Mar 26, 2022

Can I use a swap partition as a writeback device? example:
writeback-device = /dev/sda7
Sorry if this is a stupid question

@nabijaczleweli
Copy link
Collaborator

nabijaczleweli commented Mar 26, 2022

The swap signature will be erased (hopefully? I haven't tried actually, it may not get erased fully, or not until something gets written back, and that'd be worse); writeback excludes all other uses.

@lavilao
Copy link

lavilao commented Mar 26, 2022

shame, I was hoping giving my swap partition something useful to do

Nebucatnetzer added a commit to Nebucatnetzer/nixos that referenced this issue Mar 7, 2024
You can only use this with a block device so I would need a dedicated partition
for this.

systemd/zram-generator#139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

4 participants