qBittorrent and swap file - RPI4 2GB

Hi! First time here and first time RPi user :grinning:

I’ve a RPi4 2gb running DietPi v8.23.3 (fully upgraded, every package upgraded, no upgrade notification) and booting off a Samsung T7 2TB SSD (via USB3), headless.
I’m running the following services, everything installed via dietpi-software:

  • qBittorrent: using webUI for torrenting via the RPi4 from other devices on lan.
  • Samba: managing the T7, I’ve setup a folder SMB in /mnt/dietpi_userdata, gave the permissions and ownership to dietpi user and setup this folder as the Samba share. I’ve qBittorrent’s downloads, movies and tv series for Plex here.
  • Plex: streaming movies and tv series.
  • WireGuard: still have to setup so just installed but never used.

I’ve been running everything smooth and happily, using an Argon NEO so low temps too :grinning: but I’ve got a couple of questions:

  • I’ve seen a bunch of people using the T7 but the specs on the disk say 5V/1.5A and the RPi4’s USB ports share a maximum of 1.2A.
    I Was previously running a WD Elements 1TB (via USB3) without any problems, the T7 is running fine too for now.
    Should I be worried?
  • I’m having an hard time understanding how swap works.
    While torrenting I see (via DietPi Dashboard, statistics page) always low ram usage (always under 200mb) but 50-75% of swap space used, checking the processes page I see qBittorrent using 1GiB.
    Which one is corrent and what do I have to do?

Thanks in advance and have a nice day!

We recommend that external USB devices are powered by themselves and not only by the USB ports of the RPi. Especially on the RPI4, not using an external power supply could cause problems with the file system, as the USB ports of the RPi4 are not designed to power things larger than a USB stick.

You simply run out of memory. In such cases, SWAP is used to allow the system to use more memory. However, this has an impact on performance because SWAP is much slower in the file system than physical memory. It would be best not to use SWAP at all :smiley: However, this is not possible in your case as your system needs this amount and your RPI only offers 2 GB of memory. Make sure you have enough SWAP memory available. You can increase the SWAP memory space if necessary. If the SWAP memory space is also exceeded, your system will start to abort processes.

Following should show total memory usage

free -m

Alternatively, think of an SBC with 4 or 8 GB of memory.

Got it! Thanks!

Why is DietPi Dashboard - statistics reporting under 200mb ram used but DietPi Dashboard - processes reporting qBittorrent at 1GiB?

I’ve swap size at default value, what value do you reccommend?

It’s reserved vs actually used memory

Sorry, I’m a bit of a noob, can you explain better?

can you share some pictures from dashboard for the ram usage

Best is to check memory usage on CLI level using free -m

Do you need this now or when it’s torrenting?

Also, about the T7, the T7 is a NVME, would HDD require less power?

No, SSDs require less power but probably still more then the RPi 4 USB ports can handle

Thanks anyway

just share the information as it is.

Here you go

root@DietPi:~# free -m
total used free shared buff/cache available
Mem: 1899 153 1518 6 260 1745
Swap: 148 0 148

can you show htop as well. The memory consumption should be displayed in the upper right corner.

Here you go

Actually, the system is fine and the values between the dashboard and the operating system are the same.

Will send a screenshot while torrenting.

However what value should I set swap size to? I’ve read it should be 2x installed ram so in my case 4GB right?

I wouldn’t use swap when loading torrents. Network is used, also the bus to your hdd (not sure if this bus is also shared with network) and then you will also copy data from RAM also to hdd, I think the RPi will just freeze :smiley:
Maybe it’s a better approach to limit the RAM usage of qbittorrent :thinking:

Sorry what do you mean? I’m just asking what’s value should swap file size be.

On the RPi4 afaik it’s not shared.

Again, please help me better understand these points :sweat_smile:

Now torrenting ubuntu ISO:

When your system memory is full, it will use the swap file, which is located on the hard disk. This copy processes, from ram to hdd and vice versa, will slow down the system significantly. I think by default swap is also disabled, bc of this reason.