Advertisement
Shnatsel

Zram test script (quick & dirty)

Nov 22nd, 2013
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/bash
  2. #modprobe zram
  3.  
  4. totalmem=$(free | grep -e "^Mem:" | sed -e 's/^Mem: *//' -e 's/  *.*//')
  5. # use all available physical memory
  6. zram_mem=$(( totalmem * 1024 ))
  7. echo $zram_mem > /sys/block/zram0/disksize
  8.  
  9. mkfs.ext4 /dev/zram0
  10. mkdir -p /mnt/zram-ext4-test
  11. mount -o nobarrier /dev/zram0 /mnt/zram-ext4-test
  12.  
  13. # without "-s" bonnie++ will try to use files twice the size of RAM, we use 2/3 of that
  14. # "-u root" is there because the mount above is writable only by root
  15. # "-x 10" means running the bench 10 times; obviously tweakable
  16. bonnie++ -s $((totalmem / 1024 * 2 / 3)) -r 0 -u root -x 10 -q -d /mnt/zram-ext4-test/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement