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
- sudo — “Superuser do”. Runs the command with administrator rights.
- mkfs.ext4 — Make File System: create a new filesystem of type ext4.
- /dev/sdb1 — The device (partition) to format.
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
- sudo — “Superuser do”. Runs the command with administrator rights.
- mkdir — Make directory: create a new folder.
- -p — Make also any parent folders (like /mnt) if they dont exist.
- /mnt/usbdrive — Full path to the folder you want to create.
6. Mount the drive:
user@homeserver:~$ sudo mount /dev/sdb1 /mnt/usbdrive
(Replace sdb1
with the actual name of your drive.)
- sudo — “Superuser do”. Runs the command with administrator rights.
- mount — Command to attach a filesystem to a directory.
- /dev/sdb1 — The device or partition you want to mount (e.g. USB drive).
- /mnt/usbdrive — Full path to the folder where the contents will appear.
7. Check if it's mounted:
user@homeserver:~$ ls -a /mnt/usbdrive
- ls — shows files and folders in directory.
- -a — All - includes hidden files (those starting with .).
- /mnt/usbdrive — Full path to the folder you want to view.
You should see your files or an empty folder.
8. Create media folder inside:
user@homeserver:~$ sudo mkdir /mnt/usbdrive/media
- sudo — “Superuser do”. Runs the command with administrator rights.
- mkdir — Make directory: create a new folder.
- /mnt/usbdrive/media — Full path to the folder you want to create.
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
- sudo — “Superuser do”. Runs the command with administrator rights.
- blkid — Display details about all storage devices and their partitions.
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
- sudo — “Superuser do”. Runs the command with administrator rights.
- nano — A text editor used in terminal.
- /etc/fstab — A system file that contains information about disk mounts.
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
- sudo — “Superuser do”. Runs the command with administrator rights.
- mount — Command to attach a filesystem to a directory.
- -a — All - mount all filesystems listed in /etc/fstab.
If no errors appear — everything is correct. ✅
Next, we’ll configure MiniDLNA to use this media folder for streaming.