Forum › Forums › New users › New Users and General Questions › zram: Compression algorithm LZ4 is missing?
- This topic has 5 replies, 2 voices, and was last updated Jan 23-12:09 am by andfree.
-
AuthorPosts
-
January 16, 2018 at 1:19 am #5284Member
andfree
Split from topic Make old system more lightweight, because it was off topic there.
BTW, I have another one question:
$ lsmod | grep zram zram 6301 1 zzz@zzz:~ $ sudo swapon --summary Filename Type Size Used Priority /dev/sda2 partition 2120576 0 -1 /dev/zram1 partition 64096 0 100Why there’s not a “lz4_compress” line?
https://en.wikipedia.org/wiki/Zram
“From Linux kernel version 3.15 onwards (released on June 8, 2014), zram supports multiple compression streams and multiple compression algorithms. Compression algorithms include LZ4 and LZO. The default is LZO, which is faster at compressing/decompressing, but does not compress quite as efficiently as LZ4. Like most other system parameters, the compression algorithm can be selected via sysfs.”
But look at this: the kernel is 4.10.5, and lz4 is missing.
$ lsmod | grep zram zram 16017 1 yyy@antix1:~ $ sudo swapon --summary Filename Type Size Used Priority /dev/sda2 partition 2128608 0 -1 /dev/zram0 partition 111236 0 100 yyy@antix1:~ $ inxi -S System: Host: antix1 Kernel: 4.10.5-antix.1-486-smp i686 bits: 32 Desktop: IceWM 1.4.2 Distro: antiX-17_386-base Heather Heyer 24 October 2017- This topic was modified 5 years, 3 months ago by andfree.
- This topic was modified 5 years, 3 months ago by andfree.
January 19, 2018 at 4:04 pm #5518Member
mroot
::I don’t think what you are doing will show which compression algorithm you are using. Instead code this:
cat /sys/block/zram0/comp_algorithmYou should get an output like this:
[lzo] lz4 deflate lz4hc 842The output shows the compression algorithms that are available. The algorithm in the bracket is the one that is currently being used which in this case is lzo.
You may want to look at this link for more info.
-mroot
January 20, 2018 at 1:58 am #5537Memberandfree
::I don’t think what you are doing will show which compression algorithm you are using.
When lz4 algorithm is being used, there’s an output like this:
$ lsmod | grep zram zram 17197 1 lz4_compress 2606 1 zramInstead code this (…)
$ cat /sys/block/zram0/comp_algorithm [lzo] lz4 deflate lz4hc 842So, lz4 is available, but lzo is currently being used.
You may want to look at this link for more info.
Thank you. But I can’t select lz4 compression algorithm:
$ sudo echo lz4 > /sys/block/zram0/comp_algorithm bash: /sys/block/zram0/comp_algorithm: Permission deniedI suppose the cause is this:
once the device is initialised there is no way to change compression algorithm
January 20, 2018 at 8:52 am #5554Member
mroot
::Ah, I see lsmod does tell you which compression is being used if it isn’t the default (lzo). It assumes you know it’s lzo if there is no output- thats good to know.
I think that you can change compression to lz4. I assume you got zram working using the method SamK detailed in his posts using the script he modified. Since zram compression needs to be changed when it starts you probably can modify the startup script to use lz4 compression. I have looked at the script but I don’t see a place that identifies the compression that is being used. Since zram defaults to lzo it probably doesn’t have to be specified unless you want non-standard compression (lz4). I don’t know how to modify the script myself. Perhaps SamK could look at it? Maybe it could be setup so if you wanted lz4 you could uncomment a line of text and get the compression you wanted. If you do find a solution please post it I think others would probably want to switch to lz4 as well.
-mroot
January 21, 2018 at 2:01 am #5615Memberandfree
::I assume you got zram working using the method SamK detailed in his posts using the script he modified.
I did.
If you do find a solution please post it I think others would probably want to switch to lz4 as well.
I’m not this good to find it by myself. Moreover, I have disabled zram and turned it to zswap, as you wrote at this topic. So, if somebody wants me to test a solution on this (compaq) laptop, he must first tell me how to disable zswap!
I tested this on the other (toshiba) laptop:
$ cat /sys/block/zram0/comp_algorithm [lzo] lz4 xxx@antix1:~ $ lsmod | grep zram zram 12902 1 lz4_compress 2442 1 zramThe output above is confusing me. lzo is in the brackets, but the “lz4_compress” line appears.
I thought to try this:
$ sudo su [sudo] password for xxx: root@antix1:/home/xxx# echo lz4 > /sys/block/zram0/comp_algorithm bash: echo: write error: Device or resource busyI suppose this has to do with this:
once the device is initialised there is no way to change compression algorithm
I also thought to try these commands I found to the topic I referred above (but without replace zram with zswap on the toshiba laptop yet):
root@antix1:/home/xxx# echo lz4 >> /etc/initramfs-tools/modules root@antix1:/home/xxx# echo lz4_compress >> /etc/initramfs-tools/modules root@antix1:/home/xxx# update-initramfs -u update-initramfs: Generating /boot/initrd.img-4.0.5-antix.3-486-smp root@antix1:/home/xxx#This doesn’t seem to have changed the algorithm currently being used by the zram:
$ cat /sys/block/zram0/comp_algorithm [lzo] lz4- This reply was modified 5 years, 3 months ago by andfree.
January 23, 2018 at 12:09 am #5682Memberandfree
::But what is going on this desktop computer?
$ lsmod | grep zram zram 6301 1 zzz@zzz:~ $ sudo swapon --summary [sudo] password for zzz: Filename Type Size Used Priority /dev/sda2 partition 2120576 0 -1 /dev/zram1 partition 64096 460 100 zzz@zzz:~ $ cat /sys/block/zram1/comp_algorithm cat: /sys/block/zram1/comp_algorithm: No such file or directory zzz@zzz:~ $ cat /sys/block/zram0/comp_algorithm cat: /sys/block/zram0/comp_algorithm: No such file or directory zzz@zzz:~ $ inxi -Fxz System: Host: zzz Kernel: 3.7.10-antix.8-486-smp i686 bits: 32 gcc: 4.9.3 Desktop: IceWM 1.3.8 Distro: antiX-15-V_386-full Killah P 30 June 2015 Machine: Device: desktop Mobo: Gigabyte model: 8I915PL-G v: x.x serial: N/A BIOS: Award v: F2 date: 03/30/2006 CPU: Single core Intel Pentium 4 (-MT-) arch: Netburst Prescott rev.3 cache: 2048 KB flags: (lm nx pae sse sse2 sse3) bmips: 6431 clock speeds: max: 3200 MHz 1: 3200 MHz 2: 2800 MHz Graphics: Card: NVIDIA GT218 [GeForce 210] bus-ID: 01:00.0 Display Server: X.Org 1.16.4 drivers: nouveau (unloaded: modesetting,fbdev,vesa) Resolution: 1024x768@60.00hz OpenGL: renderer: Gallium 0.4 on NVA8 version: 3.3 Mesa 10.3.2 Direct Render: Yes Audio: Card-1 NVIDIA High Def. Audio Controller driver: snd_hda_intel bus-ID: 01:00.1 Card-2 Intel 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller driver: snd_intel8x0 ports: c000 c400 bus-ID: 00:1e.2 Sound: ALSA v: k3.7.10-antix.8-486-smp Network: Card-1: Marvell 88E8001 Gigabit Ethernet Controller driver: skge v: 1.14 port: 9400 bus-ID: 02:05.0 IF: eth0 state: down mac: <filter> Card-2: Atheros TP-Link TL-WN821N v2 802.11n [Atheros AR9170] driver: carl9170 v: 1:1.9.6 usb-ID: 001-003 IF: wlan0 state: N/A mac: N/A Drives: HDD Total Size: 82.4GB (34.0% used) ID-1: /dev/sda model: Excelstor_Techno size: 82.3GB ID-2: USB /dev/sdf model: Memory_Stick size: 0.1GB Partition: ID-1: / size: 74G used: 25G (35%) fs: ext4 dev: /dev/sda1 ID-2: swap-1 size: 2.17GB used: 0.00GB (0%) fs: swap dev: /dev/sda2 ID-3: swap-2 size: 0.07GB used: 0.00GB (1%) fs: swap dev: /dev/zram1 Sensors: System Temperatures: cpu: No active sensors found. Have you configured your sensors yet? mobo: N/A gpu: 54.0 Info: Processes: 103 Uptime: 18 min Memory: 212.1/500.8MB Init: SysVinit runlevel: 5 Gcc sys: 4.9.2 Client: Shell (bash 4.3.301) inxi: 2.3.54 -
AuthorPosts
- You must be logged in to reply to this topic.