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
....

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!


And some explanation (I use another bugreports)
Just comment here, #25 : 
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1215513/comments/25

...
[ 1.659040] Adding 1025396k swap on /dev/zram0. Priority:100 extents:1 
across:1025396k SS
[ 20.719906] Buffer I/O error on device zram0, logical block 256349
...

Lets try to calculate:

(what a pity, I can not see bites, only kilobites! but...)

(block ) 256349 * 4 (four kilobites per page) = 1025396k (place of "bad"
sector); as you can see, it is the last sector : ""[1.659040] Adding
1025396k swap on /dev/zram0"

Time of this error can be random.... When OS try to use this "last zram
sector", it freezes or somethind else...

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1215513

Title:
  System locks up, requires hard reset

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1215513/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to