Welcome to the blog of Mr.G
complete setup from start to finish, only the necessary parts.
sudo apt update
sudo apt install ntfs-3g
sudo nano /etc/samba/smb.conf
[share]
path = /home/dietpi
browseable = yes
read only = no
guest ok = no
valid users = dietpi
force user = dietpi
sudo systemctl restart smbd
sudo smbpasswd -a dietpi
sudo chown -R dietpi:dietpi /home/dietpi
sudo chmod -R 775 /home/dietpi
sudo mkdir -p /mnt/usb
lsblk
Examples:
sdb 30G
└─sdb1 30G → use /dev/sdb1
sda 232G
├─sda1 16M
└─sda2 232G → use /dev/sda2
👉 always use the largest partition
sudo mount -t ntfs-3g -o uid=1000,gid=1000 /dev/sdXn /mnt/usb
Check:
df -h | grep /mnt/usb
sudo nano /etc/fstab
/dev/sdXn /mnt/usb ntfs-3g uid=1000,gid=1000,remove_hiberfile,nofail 0 0
sudo systemctl daemon-reload
sudo mount -a
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
Open Explorer:
\\192.168.1.48\share
Login:
192.168.1.48\dietpi
/mnt/usbmount -a)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
After reboot, the USB drive should mount automatically at:
/mnt/usb
Lem - Warren Buffett walked into a University of Florida classroom in 1998 ... [2098423133938356224] (1)
Sam Stoffel - Jack Dorsey's simple rule for success in business [2089319019065057280]
Peter-Steinberger-What-Happens-When-4.7-_1786407922546
Monitor_server_action____
Disk_and_RAID_testing_commandsWebDev New York London AI NORWAY DIY Ideas Life Family News Clothing Invest Sports Health