1

System: macOS Monterey (12.4) 2021 Macbook Pro w/ M1 Pro

I have been using my Raspberry Pi as a Network Access Share (NAS) with Samba for around a year now without any issues. Today, however, I noticed that I no longer have access to my NAS mounted on my Raspberry Pi. I recently got a new laptop and attempted to connect to it, and I think this may have potentially caused the change I'm seeing now.

Previously, I have been able to log in to view my NAS files by going to Finder > Connect As > (Enter pi as username and my <password> as password), but now when I do these steps I get this message:

The operation can’t be completed because the original item for “my_nas” can’t be found.

My share is/was located in: /media/pi/extd, but now when I ssh into my pi and try to cd to that path, I get a message saying the following error:

-bash: cd: /media/pi/extd: No such file or directory

However, /media/pi still exists and when I enter ls, I get no files listed out.

Among the things I have tried:

  1. Relaunching Finder, logging out, and logging back into my Mac.
  2. Ensuring I have installed all the latest updates for my raspberry pi programs with:
  • sudo apt update
  • sudo apt full-upgrade
  • sudo reboot
  1. Running lsblk to see if I can see my NAS (It is the 2T one):
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  1.8T  0 disk 
└─sda1        8:1    0  1.8T  0 part 
mmcblk0     179:0    0 29.7G  0 disk 
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 29.5G  0 part /
  1. Seeing if there is anything out of the ordinary in my /etc/samba/smb.conf file:
# Global parameters
[global]
    log file = /var/log/samba/log.%m
    logging = file
    map to guest = Bad User
    max log size = 1000
    obey pam restrictions = Yes
    pam password change = Yes
    panic action = /usr/share/samba/panic-action %d
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    passwd program = /usr/bin/passwd %u
    server role = standalone server
    unix password sync = Yes
    usershare allow guests = Yes
    idmap config * : backend = tdb


[homes]
    browseable = No
    comment = Home Directories
    create mask = 0700
    directory mask = 0700
    valid users = %S


[printers]
    browseable = No
    comment = All Printers
    create mask = 0700
    path = /var/spool/samba
    printable = Yes


[print$]
    comment = Printer Drivers
    path = /var/lib/samba/printers


[my_nas]
    create mask = 0777
    directory mask = 0777
    guest ok = Yes
    path = /media/pi/extd/
    read only = No
    valid users = pi
  1. Seeing if my NAS is reachable with smbclient -N -L //<my-raspberry-pis-ip-address-here>:
do_connect: Connection to 192.168.86.29 failed (Error NT_STATUS_HOST_UNREACHABLE)

Any help would be hugely appreciated.

Edit After running systemctl status smbd, this is my output:

● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2022-07-05 20:44:07 CDT; 1h 32min ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 1714 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
 Main PID: 1715 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/smbd.service
           ├─1715 /usr/sbin/smbd --foreground --no-process-group
           ├─1718 /usr/sbin/smbd --foreground --no-process-group
           ├─1719 /usr/sbin/smbd --foreground --no-process-group
           └─1720 /usr/sbin/smbd --foreground --no-process-group

Jul 05 20:57:20 raspberrypi smbd[2150]: pam_unix(samba:session): session opened for user pi by (uid=0)
Jul 05 20:57:30 raspberrypi smbd[2150]: pam_unix(samba:session): session closed for user pi
Jul 05 21:18:00 raspberrypi smbd[2362]: pam_unix(samba:session): session opened for user pi by (uid=0)
Jul 05 21:19:00 raspberrypi smbd[2362]: pam_unix(samba:session): session closed for user pi
Jul 05 21:19:05 raspberrypi smbd[2370]: pam_unix(samba:session): session opened for user pi by (uid=0)
Jul 05 21:19:05 raspberrypi smbd[2370]: pam_unix(samba:session): session closed for user pi
Jul 05 21:19:05 raspberrypi smbd[2373]: pam_unix(samba:session): session opened for user pi by (uid=0)
Jul 05 21:19:05 raspberrypi smbd[2373]: pam_unix(samba:session): session closed for user pi
Jul 05 21:19:07 raspberrypi smbd[2375]: pam_unix(samba:session): session opened for user pi by (uid=0)
Jul 05 21:19:07 raspberrypi smbd[2375]: pam_unix(samba:session): session closed for user pi

After running sudo fdisk -l:

Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x84e25c90

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        8192   532479   524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      532480 62333951 61801472 29.5G 83 Linux


Disk /dev/sda: 1.8 TiB, 2000398843904 bytes, 3907028992 sectors
Disk model: Extreme SSD     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: 0BA8FA95-D191-472A-9756-2B141A3583B7

Device     Start        End    Sectors  Size Type
/dev/sda1   2048 3907026943 3907024896  1.8T Linux filesystem

After running sudo fsck -N /dev/sda:

[/usr/sbin/fsck.ext2 (1) -- /dev/sda] fsck.ext2 /dev/sda 
1
  • The extra data you added is irrelevant. Your drive is not mounted. What does findmnt show?
    – Milliways
    Commented Jul 7, 2022 at 4:47

3 Answers 3

3

I don't know exactly your problem BUT /media/pi/ is a poor choice. It is used for automount and can change as storage is mounted - in particular the mount point can change.

I suggest you create a mount point under /mnt although any normal directory can be used. If the storage is supposed to be there permanently you can create a /etc/fstab entry to mount on boot.

I have a number of entries (although I prefer to mount manually) e.g.

UUID=94dc6686-0eda-41ba-87f7-494d7e37f913       /mnt/PiData     ext4    defaults,noatime,noauto  0     0

You should consult the man for fstab for explanation.

NOTE it is preferable to use UUID to identify mount, rather than the ephemeral sda.

2

A few diagnostics to try out:

  • Check if the service is disabled in systemd: systemctl status smbd
    • If disabled, sudo systemctl enable smbd
    • If also dead, sudo systemctl start smbd, or just reboot
  • Is your share mounted on an external disk? If so, check that the disk is actually mounted with sudo fdisk -l. If not, mount it and add the disk to your /etc/fstab.
  • Do a dry-run fsck (not a live one) to check for filesystem problems: sudo fsck -N /dev/sda. It is preferred you do this with the filesystem unmounted on a separate system, like a fresh Raspbian install on another SD card.*
  • Check the logs thoroughly. If there is a problem with the filesystem, backup everything to another drive, boot onto a fresh Raspbian card, plug the old card in using an SD card adapter, and run fsck for real to fix the filesystem.
  • Check your lost+found directory in the old card after this operation.
  • Is your share the only thing taking up a lot of space in your system? Do a sanity check by seeing your disk utilization using df -l

*The easiest way to do this is with a live GParted disk on your main x86 machine.

Edit 1: It looks like you're using an external SSD at /dev/sda, and your SD card is /dev/mmcblk0.

Most likely the reason cd refuses to execute is because the directory no longer exists, so it cannot be mounted. Remedy this with: sudo mkdir /media/pi/extd

In your /etc/fstab, add the following line if one for the UUID or block device (/dev/X path) doesn't already exist:

UUID=0BA8FA95-D191-472A-9756-2B141A3583B7   /media/pi/extd  ext2    defaults    0   2

(This assumes that the fsck output is correct, and your SSD is formated with ext2. If not, then replace ext2 with whatever the correct filesystem type is.)

Reboot after adding the line. It may take a bit longer than usual since the filesystem is checked upon startup. If you don't want this behavior, simply change the 2 in the line above to a 0.

If you run lsblk -l again after the reboot, the MOUNTPOINT field for sda1 (or whatever the 2 TiB drive ends up being) should be populated with the path /media/pi/extd. If it is, confirm that the disk contains everything needed by navigating to /media/pi/extd and looking for files.

1

From the data in your question, it seems clear (your Step 3) from your lsblk output that your drive is not mounted. Presumably, it has been mounted previously since your NAS has been working for "about a year", but you don't mention how or where you mount command is located... is it in /etc/fstab, or a command-line mount in a cron job, or ...?

There may be additional issues, but solve this one first. Once you see a mount point listed in the output of lsblk --fs, you should edit your question if there are still issues.

If you need help w/ an entry for /etc/fstab, I've included an example below that might help. See man fstab for details.

First, ensure your mount point exists: /media/pi/extd. If not, create it using mkdir

# example entry for /etc/fstab: 
LABEL=PASSPORT2TB /media/pi/extd ext4 rw,user,nofail 0 0

Note that I use the LABEL to identify my device - in this case a 2TB Passport USB drive. Where do I get the LABEL designation? From lsblk --fs:

$ lsblk --fs
NAME        FSTYPE LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda
└─sda1      ext4   PASSPORT2TB 86645948-d127-4991-888c-a466b7722f05    1.5T    10% /mnt/Passport2TB
mmcblk0
├─mmcblk0p1 vfat               6969-16D1                             205.9M    19% /boot
└─mmcblk0p2 ext4               f6ea6ef9-68be-479d-b447-5f76391cc02f   22.9G    17% /

I use LABEL because it's meaningful to me (certainly more so than a UUID!), and it's unique - unique because I don't have enough mounted devices to risk "collisions".

The fs type in my case is ext4 - the filesystem I used to format my Passport drive. If yours is FAT32 - or whatever - use that instead.

The remaining options in the fstab entry will probably work fine for you: rw,user,nofail 0 0. You can find their meanings defined in /etc/fstab.

This entry should mount your drive each time your system is booted, thereby making it available for samba to use as an SMB share. You can make the /etc/fstab entry, and test it without having to do a reboot: After making the entry & saving your revised /etc/fstab file, enter mount -av at the command line. Hopefully this will be successful; if you don't get error messages, run lsblk --fs to verify your drive is mounted at the designated mount point.

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.