3

I run SAMBA 4.9.5 on my raspberry pi 4 and share a folder on my external hard drive(exfat as fs).
It worked all fine until I want to remotely delete or modify files on it.
I cannot delete or modify anything on the HDD from my windows pc, mac and iPhone. Nothing works. Deleting and modifying files on my boot drive works just fine. The only thing I can do is browse, create a file, change the content but when I want to rename the file or delete it I get an error saying that the requested operation is not supported.

I checked my HDD for any errors on windows but the drive is all fine.

My smb.conf

[global]
netbios name = RaspNAS
server string = NAS Server fuer Dalbudak
server role = standalone server
#min protocol = SMB2
max protocol = SMB3
#client min protocol = SMB2
client max protocol = SMB3
#server min protocol = SMB2
server max protocol = SMB3
ea support = yes
vfs objects = catia fruit streams_xattr  
fruit:metadata = stream
fruit:model = MacSamba
fruit:posix_rename = yes 
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes 
fruit:delete_empty_adfiles = yes
wins support = yes
read raw = yes
write raw = yes
log file = /etc/samba/log
encrypt passwords = yes

[HOMEPI]
path = /
comment = PI
browsable = yes
read only = no
writable = yes
Guest ok = no
force group = nas
valid users = pi
inherit owner = yes
create mask = 777
directory mask = 777
force create mode = 777
force directory mode = 777
force user = root
dos filemode = yes
store dos attributes = yes


[Mert]
path = /media/Merts-HDD/NAS/Mert
comment = Merts-NAS
browsable = yes
read only = no
writable = yes
Guest ok = no
valid users = mert pi
create mask = 777
directory mask = 777
force create mode = 777
force directory mode = 777
force user = pi
force group = nas
dos filemode = yes
store dos attributes = yes

I tried almost anything but nothing worked for me. I even edited the fstab file and rebooted like 20-30 times no results.

FSTAB entry:

/dev/sda1  /media/Merts-HDD/    exfat  defaults,nofail,noatime,async,rw,uid=1000,gid=1005,umask=000 0 0

For those how are looking for the fix:

I just got rid of all fruit settings and it was fixed for me

There is a related post for it here I did what it was suggested to do but my problem still remains. Also created a thread in a unix&linux thread here.

0

3 Answers 3

2

For the example I use Virtual Hard Drive exFAT for simulate your external drive and I use the pi user but you can easily adapt with your own paths replacing /media/VHD.exfat.bin and /mnt/VHD.exfat/ :

sudo -i

USER CONF :

addgroup nas
adduser pi nas

CREATE VIRTUAL EXFAT :

apt-get install exfat-utils exfat-fuse
if [ ! -f /media/VHD.exfat.bin ];then
dd if=/dev/zero of=/media/VHD.exfat.bin bs=1M count=150
mkexfatfs -n VHD.EXFAT /media/VHD.exfat.bin
mkdir /mnt/VHD.exfat
fi;
# MANUAL MOUNT
#mount -t exfat -o loop,uid=1000,gid=1001,umask=002 /media/VHD.exfat.bin /mnt/VHD.exfat/

# AUTO MOUNT : put this into /etc/fstab
/media/VHD.exfat.bin  /mnt/VHD.exfat/  exfat  loop,defaults,nofail,noatime,async,rw,uid=1000,gid=1001,umask=002  0  0
# mount -a

SAMBA:

apt-get install samba smbclient
systemctl stop nmbd.service
systemctl disable nmbd.service
cp -p /etc/samba/smb.conf /etc/samba/smb.conf.original

cat << EOF > /etc/samba/smb.conf
[global]
        server string = samba_server
        server role = standalone server
        interfaces = lo eth0 wlan0
        bind interfaces only = yes
        disable netbios = yes
        smb ports = 445
        log file = /var/log/samba/smb.log
        max log size = 10000 

[pi_share]
        path = /mnt/VHD.exfat
        browseable = yes
        read only = no
        force create mode = 0660
        force directory mode = 2770
        valid users = pi @nas
EOF

SMB USER CONF :

smbpasswd -a pi #add
[ENTER YOUR NEW PASSWORD HERE]
smbpasswd -e pi #enable

ACTIVATE YOUR NEW CONF:

systemctl restart smbd.service

TESTS:

testparm
touch /tmp/testfile

smbclient //127.0.0.1/pi_share -U pi
[ENTER YOUR PASSWORD HERE]
smb: \> mkdir test1    
smb: \> put /tmp/testfile test1/testfile

ls -l /mnt/VHD.exfat/
drwxrwxr-x 1 pi nas 4096 janv.  . ..:.. test1

ls -l /mnt/VHD.exfat/test1/
-rwxrwxr-x 1 pi nas 0 janv.  . ..:.. testfile

smb: \> rmdir test1
NT_STATUS_DIRECTORY_NOT_EMPTY removing remote directory file \test1
smb: \> cd test1
smb: \> del testfile
smb: \> cd ..
smb: \> rmdir test1
8
  • 1
    I already did what you stated here. Everything works just fine except the the delete permission. Commented Jan 3, 2020 at 16:31
  • 1
    I will try your smb config settings and let you know if that worked out Commented Jan 3, 2020 at 16:40
  • 2
    I know weird huh? I will try out your smb setting letting you know if that fixed it Commented Jan 3, 2020 at 16:54
  • 2
    @DOCTYPEHTML, yes , I think it's an error in smb.conf now... valid user must contain the group normally : @nas
    – Ephemeral
    Commented Jan 3, 2020 at 16:55
  • 2
    @DOCTYPEHTML, You're welcome, happy for you. Oh and you can check in /var/log/samba for more errors informations
    – Ephemeral
    Commented Jan 3, 2020 at 17:40
4

It seems you have an answer that addresses your question. I'm posting this as potentially "another answer" to augment @Ephemeral's answer, and because it's something that may be overlooked occasionally:

If you are using Raspberry Pi and samba as a file server, perhaps the easiest and most reliable file system to use is the RPi's native ext4 filesystem. In other words, format your external drive(s) as ext4 instead of exfat, fat32, ntfs, etc. This provides all the advantages inherent in the ext4 filesystem, and allows all samba clients access (i.e. Mac, Windows, Linux - any OS that supports SMB).

My personal experience using exfat with samba on RPi has been fraught with crappy little issues. It can be made to work, but I see nagging issues; e.g file names are changed by 'the system'.

NOTE: If your external drive is one that may also be mounted directly by another OS (Windows or Mac primarily), then ext4 may not be a good choice. But for serving via samba running on RPi, the samba software will "translate" the ext4 filesystem to SMB - just as it does for any other disk-based filesystem.

2
  • 1
    Yes. I decided to use exfat because it is a HDD via USB3. So I think it will be very likely that I will use it on another computer someday Commented Jan 3, 2020 at 23:44
  • That's up to you of course. However, when 'someday' comes, it's not a huge effort to backup the contents of your ext4 drive, re-format it, then restore the backed-up files.
    – Seamus
    Commented Jan 4, 2020 at 7:44
0

Same problem as yours. I have an external drive with exFAT in order to reposit the software installer (Win and Mac), so I want to share it using Raspberry Pi 4B samba so that I can directly plug into pc/mac if large installers are needed.

Sadly, the exFAT format can't work well with samba in my pi. The symptoms are as you described, that I can download, create and upload (upload will get an error sometimes), but once I rename or delete, pc/mac will get an error.

In fact, I try to reformat the drive as NTFS or ext4 and keep the original smb.conf. It works well! So I believe Samba is incompatible with exFAT. And by the way, ext4 has better performance (max write 100Mb/s) than NTFS (max write 30Mb/s), although the write speed is not stable in ext4, just like the roller coaster. I guess this is limited by raspberry pi 4B's performance.

I install paragon software to write/read ext4 in my pc.

1
  • No, my exfat drive works perfectly fine now. First you need to mount it as a user and group of your choice and then in your smb.conf you need to define the user and gruop with: force user and force group. In my case I still got the error. But it was caused by some fruit settings in the global section in my smb.conf file. If you have set any fruit options delete them or comment them and restart your samba service. Commented Jan 9, 2020 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.