From Fedora Project Wiki

No edit summary
No edit summary
Line 22: Line 22:


Last login: Mon Apr  4 14:42:45 2022 from 156.111.209.231
Last login: Mon Apr  4 14:42:45 2022 from 156.111.209.231
[core@d-zram-test-1 ~]$
</pre>
</pre>
<li>Verify the zram configuration injected by ignition is as expected.
<li>Verify the zram configuration injected by ignition is as expected.


<pre>$ cat /etc/systemd/zram-generator.conf
<pre>[core@d-zram-test-1 ~]$ cat /etc/systemd/zram-generator.conf
<li>This config file enables a /dev/zram0 device with the default settings
<li>This config file enables a /dev/zram0 device with the default settings
[zram0]
[zram0]
Line 33: Line 32:
<li>Verify zram has been correctly defined as a swap partition and to the expected size
<li>Verify zram has been correctly defined as a swap partition and to the expected size


The default is min(ram/4,4096) which in our 16GB machine instance means 4G.
<p>The default is min(ram/4,4096) which in our 16GB machine instance means 4G.


<pre>[core@d-zram-test-1 ~]$ zramctl --output-all
<pre>[core@d-zram-test-1 ~]$ zramctl --output-all

Revision as of 15:13, 4 April 2022

Description

Install and validate Fedora CoreOS with swap on zram enabled

Setup

  1. Download and verify the latest FCOS next image (pick the right image for your environment).
  2. Read background on zram here.
  3. Figure out how you'd like to configure your initial zram device.
  4. Read other possible post-boot tests as described here.

How to test

  1. Create an Ignition file.
  2. Configure Zram device validating instructions here.
  3. Launch your Fedora CoreOS system using this Ignition file. See the Quickstart and the provisioning docs for a guide how to launch FCOS in most environments (bare metal, virtual, cloud, etc).

Expected Results

  1. Verify you can SSH successfully into your FCOS system and that it is on the expected version.
    $ ssh 172.25.81.173
    Fedora CoreOS 36.20220325.1.0
    Tracker: https://github.com/coreos/fedora-coreos-tracker
    Discuss: https://discussion.fedoraproject.org/tag/coreos
    
    Last login: Mon Apr  4 14:42:45 2022 from 156.111.209.231
    
  2. Verify the zram configuration injected by ignition is as expected.
    [core@d-zram-test-1 ~]$ cat /etc/systemd/zram-generator.conf
    <li>This config file enables a /dev/zram0 device with the default settings
    [zram0]
    
  3. Verify zram has been correctly defined as a swap partition and to the expected size

    The default is min(ram/4,4096) which in our 16GB machine instance means 4G.

    [core@d-zram-test-1 ~]$ zramctl --output-all
    zramctl --output-all
    NAME       DISKSIZE DATA COMPR ALGORITHM STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED MIGRATED MOUNTPOINT
    /dev/zram0       4G   4K   80B lzo-rle         4          0   12K        0B      12K       0B [SWAP]
    [core@d-zram-test-1 ~]$ swapon
    NAME       TYPE      SIZE USED PRIO
    /dev/zram0 partition   4G   0B  100
    
  4. Saturate memory and confirm usage via zramctl

    Initially fill memory with 15GB usage and confirm usage via top. No swap.

  5. [core@d-zram-test-1 ~]$ </dev/zero head -c 15G | tail &
    [1] 1810
    [core@d-zram-test-1 ~]$ sleep 5
    [core@d-zram-test-1 ~]$ top -o %MEM -bn1 | head -n 15
    top - 14:50:20 up 14 min,  1 user,  load average: 0.60, 0.24, 0.12
    Tasks: 125 total,   3 running, 122 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  1.6 us,  1.6 sy,  0.0 ni, 95.2 id,  0.0 wa,  0.0 hi,  0.0 si,  1.6 st
    MiB Mem :  15994.1 total,    238.0 free,  15687.3 used,     68.9 buff/cache
    MiB Swap:   4096.0 total,   4068.9 free,     27.1 used.    109.9 avail Mem
    
        PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
       1810 core      20   0   15.1g  15.1g   1668 R   6.2  96.4   0:15.48 tail
       1466 root      20   0 1440984  15588   3844 S   0.0   0.1   0:00.27 dockerd
       1475 root      20   0 1345832  14856   2416 S   0.0   0.1   0:01.83 containerd
        773 root      20   0   58856  10444   9236 S   0.0   0.1   0:00.46 systemd-journal
       1513 root      20   0  770212   6928      0 S   0.0   0.0   0:00.16 docker-driver
        848 systemd+  20   0   23984   6688   3256 S   0.0   0.0   0:00.14 systemd-resolve
          1 root      20   0  172348   5396    848 S   0.0   0.0   0:03.69 systemd
       1759 core      20   0   19240   4480   1348 R  12.5   0.0   0:06.30 sshd
    

    Now add a further 3G of usage which we expect to be fulfilled by swap and therefore zram as the prioritized device.

    [core@d-zram-test-1 ~]$ </dev/zero head -c 3G | tail &
    [2] 1815
    [core@d-zram-test-1 ~]$ top -o %MEM -bn1 | head -n 15
    top - 14:50:36 up 14 min,  1 user,  load average: 0.65, 0.27, 0.14
    Tasks: 126 total,   1 running, 125 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  1.5 us,  3.1 sy,  0.0 ni, 95.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    MiB Mem :  15994.1 total,    189.2 free,  15760.8 used,     44.1 buff/cache
    MiB Swap:   4096.0 total,   1050.6 free,   3045.3 used.     48.7 avail Mem
    
        PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
       1810 core      20   0   15.1g  12.1g    280 S   6.2  77.7   0:15.87 tail
       1815 core      20   0 3162560   3.0g    264 S   6.2  19.3   0:03.57 tail
       1466 root      20   0 1440984  10548      0 S   0.0   0.1   0:00.27 dockerd
       1475 root      20   0 1345832   9648   2888 S   0.0   0.1   0:01.87 containerd
       1513 root      20   0  770212   6172      0 S   0.0   0.0   0:00.17 docker-driver
       1816 core      20   0    7856   3624   2996 R   0.0   0.0   0:00.00 top
          1 root      20   0  172348   2868      0 S   0.0   0.0   0:03.69 systemd
       1760 core      20   0    6212   2004   1644 S   0.0   0.0   0:00.55 bash
    [core@d-zram-test-1 ~]$ zramctl --output-all
    NAME       DISKSIZE DATA COMPR ALGORITHM STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED MIGRATED MOUNTPOINT
    /dev/zram0       4G   3G 35.6M lzo-rle         4     381047 43.4M        0B    47.4M      57B [SWAP]
    [core@d-zram-test-1 ~]$ swapon
    NAME       TYPE      SIZE USED PRIO
    /dev/zram0 partition   4G   3G  100
    
  6. Verify the linked documentation makes sense, nothing is obviously missing, and the instructions are clear.

    No changes required.