You have to learn the rules of the game. And then you have to play it better than anyone else.
D. Feinstein
The Raspberry Pi Model B serves as an excellent dedicated server device. Its compact size, silent operation, and low power consumption make it ideal for lightweight applications. It’s small, silent, and doesn’t consume much power. Given the Raspberry Pi’s limited specifications, it is not suited tasks for heavy-duty tasks, but it’s perfect for lightweight services such as miniDLNA. MiniDLNA is a lightweight DLNA/UPnP media server that can stream media files to DLNA/UPnP clients.
The Raspberry Pi Model B (Rev 2) runs on BCM2835 SoC featuring a 700 MHz, ARM11 dual core CPU (ARMv6 architecture) and 512 MB of RAM. The Pi has 2 x USB 2.0 ports and 100Mbps ethernet.
The project will require a raspberry Pi case, power cable, ethernet 10/100 cable, 512GB USB v2 drive to store data and an 8GB SD card for the operating system and the applications that are going to be installed
In Greece, putting the required hardware together costs around 65€.
Using iperf3 to measure bandwidth shows a maximum data transfer speed of approximately 80 Mbps. Sustained speeds typically range from 40 to 60 Mbps for unencrypted connections.
Sustained data transfer will be around 40 to 60 Mbps for plain text connections. Encryption significantly reduces data transfer speeds, with the Raspberry Pi’s CPU acting as a bottleneck for encryption and decryption processes. The CPU is not powerful enough to handle encryption/decryption at high speeds, acting as a bottleneck.
The optimal way to upload media to the raspberry pi is the good old FTP. The assumption is that that the Pi is running on a LAN.
Transferring data through tailscale, which runs on top of wireguard peaks at 5Mbps. Transferring 100MB of data through SSH took 81 seconds, while the same data transferred through FTP took around 22 seconds reaching an average speed of 40Mbps.
Streaming 1080p content typically requires between 7 and 14 Mbps of bandwidth, depending on factors such as the codec, bitrate, number of audio streams, etc. I have tested 720p and 1080p content and it works fine. In theory we should be able to stream 4k content as well, as it requires 25 to 35 Mbps, but I haven’t tested it.
Some systems support live transcoding of media files, but the Raspberry Pi is not powerful enough to handle this workflow. The Raspberry Pi can only stream media files that are supported by the client. It is recommended to transcode the media files to a more powerful system before uploading them to the Raspberry Pi.
DietPi is the operating system of choice for these kind of projects. Follow the installation instructions.
The lsblk
command lists available storage devices, while mkfs.ext4
formats the selected partition to the ext4
filesystem. That can be done using the cfdisk
command from the command line. To format and mount the USB disk:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 461.3G 0 disk
└─sda1 8:1 1 461.2G 0 part /mnt/data
mmcblk0 179:0 0 7.4G 0 disk
├─mmcblk0p1 179:1 0 128M 0 part /boot
└─mmcblk0p2 179:2 0 7.3G 0 part /
$ sudo mkfs.ext4 /dev/sda1
[...]
Now you should be able to mount the disk to the /mnt/data
directory and create the media directories:
$ sudo mount /dev/sda1 /mnt/data
$ sudo mkdir /mnt/data/{sports,family}
$ sudo chown dietpi:dietpi /mnt/data/{sports,family}
The dietpi-drive_manager
command can be used to configure the system to mount the USB drive automatically during startup.
The vsFTPd server allows secure file transfers over FTP. The settings provided ensure that users can only access specific directories and disable unnecessary features for a lightweight, secure setup.
The FTP protocol supports SSL, but it’s disabled in this setup to maximize data transfer speeds.
Assuming vsFTPd
has been installed, the configuration is set in file /etc/vsftpd.conf
:
userlist_deny=YES
local_root=/mnt/data
listen=YES
listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=002
anon_upload_enable=NO
anon_mkdir_write_enable=NO
dirmessage_enable=YES
use_localtime=YES
connect_from_port_20=YES
chown_uploads=NO
xferlog_enable=NO
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
idle_session_timeout=60
data_connection_timeout=30
async_abor_enable=NO
ascii_upload_enable=NO
ascii_download_enable=NO
ftpd_banner=DietPi FTP
chroot_local_user=NO
chroot_list_enable=NO
ls_recurse_enable=YES
secure_chroot_dir=/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
The important part is the local_root
configuration here. This setup will make sure the dietpi
user can upload files only under the /mnd/data
directory. SSL is disabled of course.
The miniDLNA configuration is set on /etc/minidlna.conf
:
media_dir=V,/mnt/data/family
media_dir=V,/mnt/data/sports
db_dir=/mnt/dietpi_userdata/.MiniDLNA_Cache
log_level=warn
network_interface=eth0
port=8200
friendly_name=DietPi MiniDLNA
serial=12345678
model_number=1
inotify=yes
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
Once the configuration is properly set and the service starts, the media files will be available to DLNA/UPnP clients. MiniDLNA can stream music and images as well.
Setting up tailscale for remote command line access is a good idea but transferring data through tailscale is pretty slow due to encryption. For remote data transfers, FTP remains the fastest option when available. Otherwise, Tailscale provides an encrypted alternative, though slower, requiring patience for larger transfers.
The Raspberry Pi Model B breathes new life as a capable media server, offering a cost-effective way to share files and media with loved ones. With a few simple steps, it transforms from an outdated device to a valuable tool for your digital needs.