/Dev
Last modified: April 14 2026 03:18:37DietPi NAS
complete setup from start to finish, only the necessary parts.
1. Install NTFS support (once)
sudo apt update
sudo apt install ntfs-3g
2. Samba setup
Edit config
sudo nano /etc/samba/smb.conf
Add this
[share]
path = /home/dietpi
browseable = yes
read only = no
guest ok = no
valid users = dietpi
force user = dietpi
Apply
sudo systemctl restart smbd
Add user
sudo smbpasswd -a dietpi
3. Fix permissions (once)
sudo chown -R dietpi:dietpi /home/dietpi
sudo chmod -R 775 /home/dietpi
4. Create USB mount point
sudo mkdir -p /mnt/usb
5. Find USB device
lsblk
Examples:
sdb 30G
└─sdb1 30G → use /dev/sdb1
sda 232G
├─sda1 16M
└─sda2 232G → use /dev/sda2
👉 always use the largest partition
6. Test mount (manual)
sudo mount -t ntfs-3g -o uid=1000,gid=1000 /dev/sdXn /mnt/usb
Check:
df -h | grep /mnt/usb
7. Auto-mount on boot
Edit
sudo nano /etc/fstab
Add
/dev/sdXn /mnt/usb ntfs-3g uid=1000,gid=1000,remove_hiberfile,nofail 0 0
Apply
sudo systemctl daemon-reload
sudo mount -a
8. If USB becomes read-only
sudo ntfsfix /dev/sdXn
If still locked:
sudo umount /mnt/usb
sudo mount -t ntfs-3g -o uid=1000,gid=1000,remove_hiberfile /dev/sdXn /mnt/usb
9. Connect from Windows
Open Explorer:
\\192.168.1.48\share
Login:
192.168.1.48\dietpi
10. What happens now
- Boot → USB auto-mounts at
/mnt/usb - Samba → always available
- Windows → access via network path
11. Simple usage flow
- Plug USB
- Reboot (or
mount -a) - Access from Windows
Done
This is the full working setup.
UUID version
Step 1 - Find the USB partition UUID
lsblk -f
Look for the USB partition, for example:
sda
├─sda1
└─sda2 ntfs 8E2A7E432A7E287B
In this example, the USB partition is:
/dev/sda2
and the UUID is:
8E2A7E432A7E287B
You can also confirm it with:
blkid /dev/sda2
Step 2 - Add the UUID mount entry to /etc/fstab
Open /etc/fstab:
sudo nano /etc/fstab
Add this line:
UUID=8E2A7E432A7E287B /mnt/usb ntfs-3g defaults,nofail,noatime,rw,uid=1000,gid=1000,umask=0022 0 0
The fstab line depends mainly on the filesystem type.
For NTFS:
UUID=YOUR-NTFS-UUID /mnt/usb ntfs-3g defaults,nofail,noatime,rw,uid=1000,gid=1000,umask=0022 0 0
For ext4:
UUID=YOUR-EXT4-UUID /mnt/usb2 ext4 defaults,nofail,noatime,rw 0 2
Main difference:
ntfs-3g = for NTFS drives, usually Windows-compatible USB drives
ext4 = for Linux-native drives
The uid=1000,gid=1000,umask=0022 part is mostly needed for NTFS/FAT/exFAT because those filesystems do not store Linux ownership/permissions the same way ext4 does.
For ext4, permissions are stored on the disk itself, so after mounting you may need to set ownership once:
sudo chown -R dietpi:dietpi /mnt/usb2
or, if your user is not dietpi:
whoami
id
Then use the correct user/group.
Make sure the mount folder exists:
sudo mkdir -p /mnt/usb
Test without rebooting:
sudo mount -a
df -h