# qBittorrent and swap file - RPI4 2GB

**URL:** <https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242>\
**Category:** General Discussion\
**Created:** [26 October 2023 08:21 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242 "2023-10-26T08:21:32Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [26 October 2023 14:18 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/21 "2023-10-26T14:18:41Z")

</div>

> [@Jappe](#):
>
> I think by default swap is also disabled, bc of this reason.

On DietPi it’s enabled by default on \<2GB ram devices. Please @Joulinar correct me if I’m wrong.

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [26 October 2023 14:32 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/22 "2023-10-26T14:32:41Z")

</div>

Yes correct, we ensure at least 2GB of ram, combined phys+SWAP. As well we store /tmp folder in memory. This needs to be taken into account if you have an app heavily storing stuff there.

In general availability of SWAP did not harm. Yes using SWAP will slow down the system as data needs to be copied between pyhs memory and SWAP. However it could help in peak periods.

If you see memory exhausting, check as well /tmp usage.

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [26 October 2023 14:44 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/23 "2023-10-26T14:44:24Z")

</div>

Got it! But why my RPi4 which is 2GB requires swap?  
Should I set it to 4GB in `dietpi-config`?

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [26 October 2023 15:01 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/24 "2023-10-26T15:01:42Z")

</div>

In general the usage of SWAP depends on your individual system usage.

As said above, by default we have located /tmp file system in memory as well. Means, if you have an app that will store a lot of data inside /tmp, your memory will be used as well. In such cases you could think of moving the temporary location for such apps to another location.

Therefore you need to watch memory usage as well as tmp file system.

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [26 October 2023 15:09 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/25 "2023-10-26T15:09:18Z")

</div>

Okay but I still don’t understand why I see in both DietPi Dashboard and `htop` less than 200MB of used RAM but 50/75% used SWAP.

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [26 October 2023 15:23 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/26 "2023-10-26T15:23:14Z")

</div>

Your SWAP is very small. It’s just 150MB. A usage of 50% means just a usage of 75MB.

In general you need to watch your system closely if and how memory will be used.

Have a look at `df -h` if /tmp is used. As well on `htop` you see different colour codes. Most of ram is yellow. Means something is cached into memory. Could be some temporary data [linux - What exactly do the colors in htop status bars mean? - Server Fault](https://serverfault.com/questions/180711/what-exactly-do-the-colors-in-htop-status-bars-mean)

Dashboard don’t count these cached data.

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [26 October 2023 15:39 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/27 "2023-10-26T15:39:39Z")

</div>

> [@Joulinar](#):
>
> Have a look at `df -h` if /tmp is used. As well on `htop` you see different colour codes. Most of ram is yellow. Means something is cached into memory. Could be some temporary data [linux - What exactly do the colors in htop status bars mean? - Server Fault](https://serverfault.com/questions/180711/what-exactly-do-the-colors-in-htop-status-bars-mean)

Will reporst asap I torrent something!  
Thanks.

---

<div class="post-metadata">

**Author:** ![WarHawk](https://dietpi.com/forum/user_avatar/dietpi.com/warhawk/32/21_2.png) [@WarHawk](https://dietpi.com/forum/u/WarHawk)\
**Post date:** [27 October 2023 02:29 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/28 "2023-10-27T02:29:16Z")

</div>

I would put a 1x zram swap in…it can compress quite a bit, so I would say do a 2048MB (2GB zram swap) this way it doesn’t have to write/read to the physical media)

I believe dietpi supports zram swap, you can see if it’s active/enabled with  
`# cat /proc/swaps`

If you see a zram entry, it active, you can then adjust the size and compression algorithm in the  
`/etc/default/zramswap`  
file  
Mine is as follows for a 1GB zram swap on an [AtomicPi](https://www.digital-loggers.com/api_faqs.html) I use to run my Anet A8 3D printer

```auto
warhawk@AtomicPI:/etc/default$ cat /etc/default/zramswap
# Compression algorithm selection
# speed: lz4 > zstd > lzo
# compression: zstd > lzo > lz4
# This is not inclusive of all that is available in latest kernels
# See /sys/block/zram0/comp_algorithm (when zram module is loaded) to see
# what is currently set and available for your kernel[1]
# [1] https://github.com/torvalds/linux/blob/3a568e3a961ba330091cd031647e4c303fa0badb/Documentation/blockdev/zram .txt#L86
ALGO=lz4

# Specifies the amount of RAM that should be used for zram
# based on a percentage the total amount of available memory
# This takes precedence and overrides SIZE below
#PERCENT=10

# Specifies a static amount of RAM that should be used for
# the ZRAM devices, this is in MiB
SIZE=1024

# Specifies the priority for the swap devices, see swapon(2)
# for more details. Higher number = higher priority
# This should probably be higher than hdd/ssd swaps.
PRIORITY=100

```

[https://manpages.debian.org/testing/zram-tools/zramswap.1.en.html](https://manpages.debian.org/testing/zram-tools/zramswap.1.en.html)

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [27 October 2023 06:24 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/29 "2023-10-27T06:24:15Z")

</div>

`zram` is supported directly via our configuration options. No need to perform manual configuration.

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [27 October 2023 06:27 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/30 "2023-10-27T06:27:44Z")

</div>

Hi again @Joulinar  
Is it enabled by default or do I have to enable it? If the second one, how can I enable and what are the best settings?

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [27 October 2023 06:41 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/31 "2023-10-27T06:41:57Z")

</div>

> [@anon73635786](#):
>
> Is it enabled by default

nope

> [@anon73635786](#):
>
> how can I enable

⬇

```auto
/boot/dietpi/func/dietpi-set_swapfile 1024 zram

```

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [27 October 2023 07:11 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/32 "2023-10-27T07:11:24Z")

</div>

Thanks will this be used as swap and allowing me to have 1GB of swap?

Completly unreleted but I was fiddling with qBittorrent’s advanced settings and have disabled disk io read/write OS cache, started downloading Ubuntu and it failed, I then paused and removed the torrent but think everything crashed, rebooted (multiple times) and cannot do anything: cannot login via SSH, DietPi Dashboard shows nothing. Can you help me please?

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [27 October 2023 07:34 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/33 "2023-10-27T07:34:09Z")

</div>

> [@anon73635786](#):
>
> cannot login via SSH

connect a screen and check what happen

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [27 October 2023 07:35 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/34 "2023-10-27T07:35:10Z")

</div>

I’ve disabled HDMI output 🥲

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [27 October 2023 07:51 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/35 "2023-10-27T07:51:04Z")

</div>

while disabling HDMI on RPI, you should have seen the information on how to reenable 😉

```auto
Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the following files on first partition
of the SDcard from external system:                                                                               
 - In config.txt, set "hdmi_ignore_hotplug=0" and comment/remove the "max_framebuffers=0" line.                   
 - In dietpi.txt, set "AUTO_SETUP_HEADLESS=0".                                                                    

```

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [27 October 2023 07:53 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/36 "2023-10-27T07:53:11Z")

</div>

Will try and report back!  
Thanks for now!

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [27 October 2023 09:11 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/37 "2023-10-27T09:11:41Z")

</div>

Thanks @Joulinar everything’s good again! Don’t really know what happened as when I booted up and hooked a monitor everything was normal 🤔

Is there a funcion/tool to check if everything is running fine or there’s any problem? Hadn’t see any error while booting with monithor hooked.

> [@anon73635786](#):
>
> Thanks will this be used as swap and allowing me to have 1GB of swap?

Can you answer this too? Also is zram/zswap better then swap?

Thanks again!

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [27 October 2023 10:26 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/38 "2023-10-27T10:26:40Z")

</div>

> [@anon73635786](#):
>
> Is there a funcion/tool to check if everything is running fine

one option is to check status of all services.

```auto
dietpi-services status

```

> [@anon73635786](#):
>
> Also is zram/zswap better then swap?

Maybe this give some inside. [Alan Doyle - Swap vs ZSwap vs zRAM](https://alandoyle.com/blog/swap-vs-zswap-vs-zram/)  
I’m not sure if there will be black or white answer 🙂

---

<div class="post-metadata">

**Author:** ![anon73635786](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/a/5e9695/32.png) [@anon73635786](https://dietpi.com/forum/u/anon73635786)\
**Post date:** [27 October 2023 10:29 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/39 "2023-10-27T10:29:03Z")

</div>

> [@Joulinar](#):
>
> one option is to check status of all services.
> 
> ```auto
> dietpi-services status
> 
> ```

Everything’s fine 👍

> [@Joulinar](#):
>
> Maybe this give some inside. [Alan Doyle - Swap vs ZSwap vs zRAM](https://alandoyle.com/blog/swap-vs-zswap-vs-zram/)  
> I’m not sure if there will be black or white answer 🙂

Thanks! Will have a look at this.  
Just a question: do I need to disable swap once created zram or I just run your command above? Also only 1GB?

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [27 October 2023 10:34 UTC](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242/40 "2023-10-27T10:34:20Z")

</div>

> [@anon73635786](#):
>
> do I need to disable swap once created zram

to be on save side, disable SWAP first before creating zRAM

```auto
/boot/dietpi/func/dietpi-set_swapfile 0
/boot/dietpi/func/dietpi-set_swapfile 1024 zram

```

> [@anon73635786](#):
>
> Also only 1GB?

yes, that would be half of your physical memory. Let’s start with this value.

[Previous page](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242.md?page=1)

[Next page](https://dietpi.com/forum/t/qbittorrent-and-swap-file-rpi4-2gb/18242.md?page=3)
