Forum › Forums › General › Tips and Tricks › ZRAM Swap Activation
- This topic has 1 reply, 2 voices, and was last updated Dec 16-5:21 pm by Anonymous.
-
AuthorPosts
-
November 5, 2017 at 4:46 am #1891Forum Admin
SamK
This is rescued from the defunct antiX forum for the benefit of new users who cannot access that old forum and others who might not have seen the original topic. It deals with starting, and checking, zram and tweaking related performance on an old system manufactured around 2009.
Wed Nov 04, 2015 6:45 am #5
quote SamKWed Nov 04, 2015 quote
rokytnji:
Can I get the command syntax to run zram at boot as user root for AntiX/icewm startup?Try the steps outlined in zram file
sudo cp /usr/local/bin/zram / etc/init.d/ sudo update-rc.d zram defaultsReboot
Check whether zram loaded
lsmod | grep zram sudo swapon --summaryWed Nov 04, 2015
quote rokytnji:$ harry@biker:~ lsmod | grep zram zram 24576 2 lz4_compress 16384 1 zram harry@biker:~ $ sudo swapon --summary [sudo] password for harry: Filename Type Size Used Priority /dev/zram0 partition 257172 0 100 /dev/zram1 partition 257172 0 100Thank you very much SamK. Readout is after a reboot on this netbook.
$ linuxinfo Linux biker 4.2.1-antix.2-486-smp #5 SMP Wed Sep 30 15:14:04 EEST 2015 Two Intel Unknown 1600MHz processors, 6383.92 total bogomips, 2009M RAM System library 2.19.0$ free total used free shared buffers cached Mem: 2057400 564356 1493044 35036 29436 247932 -/+ buffers/cache: 286988 1770412 Swap: 514344 0 514344$ sudo parted -l Model: ATA KingSpec KSD-ZF1 (scsi) Disk /dev/sda: 63.3GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 8914MB 8913MB primary ext4 2 8914MB 63.3GB 54.4GB primary ext4 Model: Unknown (unknown) Disk /dev/zram0: 263MB Sector size (logical/physical): 4096B/4096B Partition Table: loop Disk Flags: Number Start End Size File system Flags 1 0.00B 263MB 263MB linux-swap(v1) Model: Unknown (unknown) Disk /dev/zram1: 263MB Sector size (logical/physical): 4096B/4096B Partition Table: loop Disk Flags: Number Start End Size File system Flags 1 0.00B 263MB 263MB linux-swap(v1)I love learning something new every day. 🙂
Thu Nov 05, 2015 7:36 am #7
SamK:rokytnji wrote:
I love learning something new every day.With zram working there are plenty of opportunities for that.
Things to explore…
If the amount of swap space created by zram is not large enough for your needs you might partner zram swap with a conventional swap file. You have the choice of starting them manually and individually after boot-up, or automatically during boot-up (zram via /etc/init.d/zram and swap file via /etc/rc.local).
If you use zram and a swap file in partnership, you might want to manage the order in which they are used. A swap space in RAM is faster than a swap file in conventional storage. Consider whether there is any benefit to your local system in assigning the zram swap space a higher priority than the swap file. zram space is usually created with a priority of 100. Assign a lower priority to the swap file (e.g. 90) when activating via the swapon command.
The way in which your system handles any and all swap spaces can be tuned with plenty of scope for experimentaion. The following are entries that I have used for some years as starting points in /etc/sysctl.d/local.conf. They are then adjusted to suit the characteristics of the particular system.
# Uncomment the following two values to improve percieved system performance # Threshold at which swapping starts # Values lower than default favour filling physical RAM before begining to use a swap area # Default vm.swappiness=60 vm.swappiness=10 # # Threshold at which the directory and inode caches are reclaimed # Values lower than default favour retaining them rather than recovering the memory they occupy # Default vm.vfs_cache_pressure=100 vm.vfs_cache_pressure=50A related matter…
I know you are moving to newer kit than previously. I mention the following just in case you try zram on older kit.
The basic action of zram is to create a swap space per CPU in the local system (zram0, zram1…). In a modern system with multiple CPUs the shipped zram script does this OK. In an older single CPU system the shipped zram script calculates the number incorrectly and therefore creates an incorrect number of swap spaces. It still works but just with the wrong number of swap spaces.
Because antiX is aimed at both modern and older kit I found the shipped zram script disappointing and unsatisfactory. Eventually I decided to do something about it and rewrote my own version of the zram script which works correctly with both single and multiple CPU systems.
December 16, 2017 at 5:21 pm #3898Anonymous
::v— paraphrased instructions found in 2012 oldforums topic
To have zRam start at bootup:
• cp /usr/local/bin/zram /etc/init.d/zram
• ensure owner and group are root:root
• ensure permissions are rwxr-xr-x
• run the command update-rc.d zram defaults
• reboot the systemTo check that it has loaded, look at the size of the swap reported by conky (if you use conky). Alternatively, a command such as blkid -o list should list a /dev/zram0 mounted as swap
-
AuthorPosts
- You must be logged in to reply to this topic.