両方とも前のリビジョン 前のリビジョン 次のリビジョン 前のリビジョン hardware:raspberry_pi:dietpi:zram_swap [2022/08/03 09:07] – [ZRAM にさらに Swap を 3072MB 追加する] ともやん hardware:raspberry_pi:dietpi:zram_swap [2025/06/02 04:54] (現在) – [ZRAM の他にさらに Swap を 3072MB 追加する] ともやん
</WRAP> </WRAP>
=== ZRAM の他にさらに Swap を 3072MB 追加する === === ZRAM の他にさらに Swap を 2048MB 追加する ===
<WRAP color_term> <WRAP color_term>
<WRAP color_command><html><pre> <WRAP color_command><html><pre>
$ sudo fallocate -l 3072M /var/swap <font color="#AFFF00"><b> $</b></font> <font color="#26A269"><u style="text-decoration-style:solid"> sudo</u></font> <font color="#26A269"> fallocate</font> <font color="#A347BA"> -l</font> 2048M /var/swap
$ sudo chmod 0600 /var/swap <font color="#AFFF00"><b> $</b></font> <font color="#26A269"><u style="text-decoration-style:solid"> sudo</u></font> <font color="#26A269"> chmod</font> 0600 <u style="text-decoration-style:solid"> /var/swap</u>
<font color="#AFFF00"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269"><b>mkswap</b></font> <u style="text-decoration-style:solid">/var/swap</u>
</pre></html></WRAP> </pre></html></WRAP>
<WRAP color_result><html><pre> <WRAP color_result><html><pre>
Setting up swapspace version 1, size = 3 GiB (3221221376 bytes) Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=9239781e -559a -47a4 -b17c -f9f359004181 no label, UUID=1a4e054d -d8b8 -4b3f -8ca3 -5143af119936
</pre></html></WRAP> </pre></html></WRAP>
<WRAP color_command><html><pre> <WRAP color_command><html><pre>
$ sudo swapon /var/swap <font color="#AFFF00"><b> $</b></font> <font color="#26A269"><u style="text-decoration-style:solid"> sudo</u></font> <font color="#26A269"><b> swapon</b></font> <font color="#A347BA">-v</font> <u style="text-decoration-style:solid"> /var/swap</u>
$ sudo swapon -s
</pre></html></WRAP> </pre></html></WRAP>
<WRAP color_result><html><pre> <WRAP color_result><html><pre>
Filename Type Size Used Priority swapon: /var/swap: found signature [pagesize=4096, signature=swap]
/dev /zram0 partition 487420 0 -2 swapon: /var /swap: pagesize=4096, swapsize=2147483648, devsize=2147483648
/var/swap file 3145724 0 -3 swapon /var/swap
</pre></html></WRAP> </pre></html></WRAP>
<WRAP color_command><html><pre> <WRAP color_command><html><pre>
$ free -m <font color="#AFFF00"><b> $</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#C01C28"><b>swapon</b></font> <font color="#A347BA">-s</font>
</pre></html></WRAP>
<WRAP color_result><html><pre>
Filename Type Size Used Priority
/dev/zram0 partition 485372 0 -2
/var/swap file 2097148 0 -3
</pre></html></WRAP>
<WRAP color_command><html><pre>
<font color="#AFFF00"><b>$</b></font> <font color="#26A269"> free</font> <font color="#A347BA"> -m</font>
</pre></html></WRAP> </pre></html></WRAP>
<WRAP color_result><html><pre> <WRAP color_result><html><pre>
total used free shared buff/cache available total used free shared buff/cache available
Mem: 477 29 405 1 42 402 Mem: 477 29 405 1 42 402
Swap: 3499 55 3444 Swap: 2521 0 2521
</pre></html></WRAP> </pre></html></WRAP>
</WRAP> </WRAP>
<WRAP color_term> <WRAP color_term>
<WRAP color_command><html><pre> <WRAP color_command><html><pre>
$ echo ' /var/swap none swap sw' | sudo tee -a /etc/fstab <font color="#AFFF00"><b> $</b></font> <font color="#26A269"> echo</font> <font color="#A2734C">' /var/swap none swap sw 0 0'</font> <font color="#12488B"><b> |</b></font> <font color="#26A269"><u style="text-decoration-style:solid"> sudo</u></font> <font color="#26A269"> tee</font> <font color="#A347BA"> -a</font> <u style="text-decoration-style:solid"> /etc/fstab</u>
</pre></html></WRAP> </pre></html></WRAP>
<WRAP color_result><html><pre> <WRAP color_result><html><pre>
/var/swap none swap sw /var/swap none swap sw 0 0
</pre></html></WRAP> </pre></html></WRAP>
</WRAP> </WRAP>
※[[https://unix.stackexchange.com/questions/365953/what-sw-means-in-the-fstab-swap-entry-for-mount-options-column|What 'sw' means in the fstab swap entry for 'mount options' column]]\\
[[https://forums.ubuntulinux.jp/viewtopic.php?id=20079|Ubuntu日本語フォーラム / swap fileの設定をfstabへの記述するときの設定値の違いについて]]\\
==== dietpi-set_swapfile の動作... ==== ==== dietpi-set_swapfile の動作... ====