Comment 43 for bug 1215513

Revision history for this message
kitten_geek (kitty-nice) wrote :

here is solution:

run mkswap with "-c"
mkswap -c /dev/zram0

(you can fix this in package zram-config, if you want :)
cat /etc/init/zram-config.conf | grep mkswap
    mkswap /dev/zram${DEVNUMBER}

you need to change this line to:
    mkswap -c /dev/zram${DEVNUMBER}

Explanation:

See:

modprobe zram zram_num_devices=1

( dmesg | grep zram ) :

[ 979.545213] zram: module is from the staging directory, the quality is unknown, you have been warned.
[ 979.550810] zram: Creating 1 devices ...

Next:

echo $((345*1024*1024)) > /sys/block/zram0/disksize

(dmesg still silent....)

Next:

mkswap /dev/zram0
Setting up swapspace version 1, size = 353276 KiB
no label, UUID=a95522e0-fb27-4dce-8006-3e3cbf9a6f75

(dmesg:)

[ 1115.120823] Buffer I/O error on device zram0, logical block 88319
[ 1115.120838] Buffer I/O error on device zram0, logical block 88319
[ 1115.121111] Buffer I/O error on device zram0, logical block 88319
[ 1115.121145] Buffer I/O error on device zram0, logical block 88319
[ 1115.121166] Buffer I/O error on device zram0, logical block 88319
[ 1115.121191] Buffer I/O error on device zram0, logical block 88319
[ 1115.121212] Buffer I/O error on device zram0, logical block 88319
[ 1115.121347] Buffer I/O error on device zram0, logical block 88319
[ 1115.121376] Buffer I/O error on device zram0, logical block 88319
[ 1115.121431] Buffer I/O error on device zram0, logical block 88319
[ 1127.081652] Buffer I/O error on device zram0, logical block 88319
[ 1127.081671] Buffer I/O error on device zram0, logical block 88319
[ 1127.081952] Buffer I/O error on device zram0, logical block 88319
[ 1127.081987] Buffer I/O error on device zram0, logical block 88319
[ 1127.082007] Buffer I/O error on device zram0, logical block 88319
[ 1127.082028] Buffer I/O error on device zram0, logical block 88319
[ 1127.082046] Buffer I/O error on device zram0, logical block 88319
[ 1127.082183] Buffer I/O error on device zram0, logical block 88319
[ 1127.082211] Buffer I/O error on device zram0, logical block 88319
[ 1127.082265] Buffer I/O error on device zram0, logical block 88319

See! "logical block 88319"! 88319 * 4096 = 361754624; error on bite number 361754624 (one block = 4096 bites)

I was create 361758720 bites (echo $((345*1024*1024)) returns 361758720;

3617858720 (memory, for zram) - 361754624 (number of bite with error ) = 4096!

Zram create device, with damaged last sector!

How to solve it?

mkswap --help:

....
 -c, --check check bad blocks before creating the swap area

mkswap -c /dev/zram0
one bad page
Setting up swapspace version 1, size = 353272 KiB
no label, UUID=bb7a0771-5f00-47b0-9238-723b8cd61b20

Yes, one bad page!

(you can see difference in size; - without "-c" option "size = 353276 KiB", with it - succesfully find "one bad page", and size is 4 KB less:
size = 353272 KiB

....
swapon /dev/zram0 -p 10

and, dmesg:

 1546.782347] Buffer I/O error on device zram0, logical block 88319
[ 1546.782369] Buffer I/O error on device zram0, logical block 88319
[ 1546.782500] Buffer I/O error on device zram0, logical block 88319

....

You can see, time(in beginning of "dmesg"): time not when you run "swapon", time = time when "mkswap" check partition"; so, your "swap" is safe and stable!

Enjoy!