root@myserver:/drivemount#

Step 7: Mount a Drive for Media Files

We will connect an external USB drive to store media files (movies, music, etc.). Follow these steps carefully.

1. See current drives:

user@homeserver:~$ lsblk

This command shows all connected disks. You’ll see something like:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 120G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 100G 0 part /
└─sda3 8:3 0 19G 0 part [SWAP]

2. Plug in your USB drive or flash stick.

3. Run lsblk again:

user@homeserver:~$ lsblk

Now you should see a new disk added, for example:

sdb 8:16 1 64G 0 disk
└─sdb1 8:17 1 64G 0 part

The new device is /dev/sdb1 — this is your USB drive.

Important: The name sdb1 may be different on your system. Identify the new drive by size or by noting what was added compared to the first lsblk output.

4. Format USB drive to ext4-file system with the actual name of your drive. Warning: all data will be lost:

user@homeserver:~$ sudo mkfs.ext4 /dev/sdb1

This command formats the device /dev/sdb1 with the ext4 filesystem, which is a standart Linux file system.

5. Create a mount point:

We will mount this drive into the /mnt directory:

user@homeserver:~$ sudo mkdir -p /mnt/usbdrive

6. Mount the drive:

user@homeserver:~$ sudo mount /dev/sdb1 /mnt/usbdrive

(Replace sdb1 with the actual name of your drive.)

7. Check if it's mounted:

user@homeserver:~$ ls -a /mnt/usbdrive

You should see your files or an empty folder.

8. Create media folder inside:

user@homeserver:~$ sudo mkdir /mnt/usbdrive/media

This folder will be used by MiniDLNA.

9. Make it mount automatically after reboot:

First, get the UUID of the drive:

user@homeserver:~$ sudo blkid

Find the line for /dev/sdb1 and copy the UUID. For example:

/dev/sdb1: UUID="1234-ABCD" TYPE="vfat"

Now open /etc/fstab for editing:

user@homeserver:~$ sudo nano /etc/fstab

Add this line at the bottom (replace the UUID with yours):

UUID=1234-ABCD /mnt/usbdrive ext4 defaults 0 2

Save and exit nano:

Ctrl + O → Enter → Ctrl + X

Test the fstab line:

user@homeserver:~$ sudo mount -a

If no errors appear — everything is correct. ✅

Next, we’ll configure MiniDLNA to use this media folder for streaming.