npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 9:56 am

Two Raspberry Pi's here.
The local one has an external HDD /dev/sda1/ mounted on /media/pi/EXT500

This is not for permanent mounting ..just when I am doing an image backup

See comments and posts about fstab entry ..that is for permanent mounting yes? so i do not need it for a temporary mount?

I want to physically connect the HDD via USB to the local Pi and mount it on my Pi that is in the attic over the network to do an image-backup from it, . Save me getting the ladder out, crawling in attic etc.

have tried these links

https://www.cyberciti.biz/faq/linux-mou ... ows-share/
https://www.stuffaboutcode.com/2012/05/ ... share.html
https://www.cyberciti.biz/faq/linux-mou ... ows-share/
http://cagewebdev.com/raspberry-pi-conn ... ork-drive/
viewtopic.php?t=243891


The local HDD is ext4 format and have smb shares.....so the use of cifs ? is that correct? or ??"

Tied so many combinations ..here are a few I have failed to get to mount

Code: Select all

sudo mount -t cifs //192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs //192.168.1.56/media/pi/EXT500 /mnt/netEXT500 -o username=pi,passwrod=WXYZ123, workgroup=home
mount: bad usage
Try 'mount --help' for more information.
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs //192.168.1.56/media/pi/EXT500 /mnt/netEXT500 -o username=pi,password=WXYZ123,workgroup=home
Couldn't chdir to /mnt/netEXT500: No such file or directory
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs //192.168.1.56/media/pi/EXT500 /mnt/netEXT500/ -o username=pi,password=WXYZ123,workgroup=home
Couldn't chdir to /mnt/netEXT500/: No such file or directory
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs //192.168.1.56/media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs //192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
mount: bad usage
Try 'mount --help' for more information.
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs //192.168.1.56 /dev/sda1 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
mount: bad usage
Try 'mount --help' for more information.
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t smb://192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
mount: /mnt/netExt500: unknown filesystem type 'smb://192.168.1.56'.
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs//192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
mount: /mnt/netExt500: unknown filesystem type 'cifs//192.168.1.56'.
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t cifs //192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
mount: bad usage
Try 'mount --help' for more information.
pi@rsp1a-rsp-tcp:/etc $ sudo mount -t ext4 //192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
mount: bad usage
Try 'mount --help' for more information.
pi@rsp1a-rsp-tcp:/etc $ sudo mount.cifs //192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
Couldn't chdir to /media/pi/EXT500: No such file or directory
pi@rsp1a-rsp-tcp:/etc $ cd /media
pi@rsp1a-rsp-tcp:/media $ ls
EXT500
pi@rsp1a-rsp-tcp:/media $ cd EXT500
pi@rsp1a-rsp-tcp:/media/EXT500 $ pwd
/media/EXT500
pi@rsp1a-rsp-tcp:/media/EXT500 $ sudo mount.cifs //192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=homecd /mnt
Couldn't chdir to /media/pi/EXT500: No such file or directory
pi@rsp1a-rsp-tcp:/media/EXT500 $ cd /media
pi@rsp1a-rsp-tcp:/media $ ls
EXT500
pi@rsp1a-rsp-tcp:/media $ cd EXT500
pi@rsp1a-rsp-tcp:/media/EXT500 $ ls
pi@rsp1a-rsp-tcp:/media/EXT500 $ sudo mount.cifs //192.168.1.56 /media/pi/EXT500 /mnt/Ext500/ -o username=pi,password=WXYZ123,workgroup=homecd /mnt
Couldn't chdir to /media/pi/EXT500: No such file or directory
pi@rsp1a-rsp-tcp:/media/EXT500 $ cd /
pi@rsp1a-rsp-tcp:/ $ cd
pi@rsp1a-rsp-tcp:~ $ 
pi@rsp1a-rsp-tcp:~ $ ls
Dev  Downloads  pishare
pi@rsp1a-rsp-tcp:~ $ cd /
pi@rsp1a-rsp-tcp:/ $ ls
bin   dev  home  lost+found  mnt  proc  run   srv  tmp  var
boot  etc  lib   media       opt  root  sbin  sys  usr
pi@rsp1a-rsp-tcp:/ $ cd mnt
pi@rsp1a-rsp-tcp:/mnt $ ls
netExt500
pi@rsp1a-rsp-tcp:/mnt $ cd netEXT500
-bash: cd: netEXT500: No such file or directory
pi@rsp1a-rsp-tcp:/mnt $ ls
netExt500
pi@rsp1a-rsp-tcp:/mnt $ cd netExt500/
pi@rsp1a-rsp-tcp:/mnt/netExt500 $ cd ..
pi@rsp1a-rsp-tcp:/mnt $ sudo rm -R *
pi@rsp1a-rsp-tcp:/mnt $ ls
pi@rsp1a-rsp-tcp:/mnt $ sudo mkdir netExt500
pi@rsp1a-rsp-tcp:/mnt $ ls
netExt500
pi@rsp1a-rsp-tcp:/mnt $ cd netExt500


it is this

pi@rsp1a-rsp-tcp:/ $ sudo mount.cifs //192.168.1.56 /media/pi/EXT500 /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
Couldn't chdir to /media/pi/EXT500: No such file or directory
pi@rsp1a-rsp-tcp:/ $

that is pissing me off..there bloody well is a /media/pi/EXT500 directory .

Some syntax some where I have wrong?
Last edited by npaisnel on Sat Jun 19, 2021 10:37 am, edited 1 time in total.

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi

Sat Jun 19, 2021 10:06 am

Well . i got it to 'execute' with no error.

but it does not show the mount

Code: Select all

pi@rsp1a-rsp-tcp:/mnt/netExt500 $ sudo mount -a //192.168.1.56 /media/pi/EXT500/ /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
pi@rsp1a-rsp-tcp:/mnt/netExt500 $ cd ..
pi@rsp1a-rsp-tcp:/mnt $ ls
netExt500
pi@rsp1a-rsp-tcp:/mnt $ cd netExt500
pi@rsp1a-rsp-tcp:/mnt/netExt500 $ ls
pi@rsp1a-rsp-tcp:/mnt/netExt500 $ 

The HDD on the other machine has this :

Code: Select all

pi@HomeVision:/mnt $ cd /media/pi
pi@HomeVision:/media/pi $ ls
EXT500
pi@HomeVision:/media/pi $ cd EXT500
pi@HomeVision:/media/pi/EXT500 $ ls 
BiT  lost+found  PepperMint  RPi2  RPi3  timeshift
pi@HomeVision:/media/pi/EXT500 $ 

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi

Sat Jun 19, 2021 10:30 am

If I do smb://192.168.1.56/ext on the mac, then Finder opens and the share is visible...
So pretty sure it is set correctly on the server side.


Code: Select all

pi@rsp1a-rsp-tcp:/mnt/netExt500 $ sudo apt-get install smbfs smbclient
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package smbfs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  cifs-utils

E: Package 'smbfs' has no installation candidate
pi@rsp1a-rsp-tcp:/mnt/netExt500 $ sudo apt-get install cifs-utils
Reading package lists... Done
Building dependency tree       
Reading state information... Done
cifs-utils is already the newest version (2:6.8-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@rsp1a-rsp-tcp:/mnt/netExt500 $ 

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi

Sat Jun 19, 2021 10:36 am

Well....I can go off to the wedding of a friend this afternoon with out this buzzing around my head..

Got !

Code: Select all

sudo mount //192.168.1.56/ext /mnt/netExt500/ -o username=pi,password=WXYZ123

epoch1970
Posts: 6685
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Mounting a network HDD on a remote Pi

Sat Jun 19, 2021 10:39 am

Did you read the official documentation page on this https://www.raspberrypi.org/documentati ... s/samba.md and the manual page for mount? (“man mount”)

You ran

Code: Select all

 sudo mount -a //192.168.1.56 /media/pi/EXT500/ /mnt/netExt500/ -o username=pi,password=WXYZ123,workgroup=home
I think I would try

Code: Select all

 sudo mount -t cifs  -o username=pi,password=WXYZ123,workgroup=home //192.168.1.56/media/pi/EXT500/ /mnt/netExt500/
/etc/fstab is used to store mount specifications. When the system boots it runs “mount -a”, meaning basically it reads fstab and executes every line not marked with option “noauto”

Add your mount to fstab once it works, with option noauto (or probably better noauto,nofail.)
That will allow you to mount/unmount on demand using a shorter command form, e.g. “mount /mnt/netExt500”
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
thagrol
Posts: 5215
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 10:51 am

A couple of suggestions:
  1. fstab can be used for temporary/manual mounts. Include the noauto option then sudo mount -a or sudo mount /path/to/mountpoint
  2. You may find that ownership and permissions on the client Pi are not what you expect them to be. They'll most likely be root:root owner an group and 755 permissions for everything.
  3. You might want to switch to NFS instead of CIFS/Samba. NFS is linux native, has better perofrmance, and full support for linux owner, group, and permissions.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 10:57 am

That is one I did not find, no...thank you

I did get it mounted.. but now have permissions issue ..... but off to a wedding now ...or in an hour...


So many links to read..and "man" pages ..TBH unless you are an expert..man ages are about as much use as a chocolate fire guard !

Code: Select all

pi@rsp1a-rsp-tcp:/mnt/netExt500/RPi3/New_images/RSP1a $ sudo /bin/image-backup 

Image file to create? /mnt/netExt500/RPi3/New_images/RSP1a/RPi3-210619-API3-RSTCP.img

Initial image file ROOT filesystem size (MB) [1734]? 1800

Added space for incremental updates after shrinking (MB) [0]? 50

Create /mnt/netExt500/RPi3/New_images/RSP1a/RPi3-210619-API3-RSTCP.img (y/n)? y
truncate: cannot open '/mnt/netExt500/RPi3/New_images/RSP1a/RPi3-210619-API3-RSTCP.img' for writing: Permission denied

Unable to create image file

pi@rsp1a-rsp-tcp:/mnt/netExt500/RPi3/New_images/RSP1a $ sudo /bin/./image-backup 

Image file to create? /mnt/netExt500/RPi3/New_images/RSP1a/RPi3-210619-API3-RSTCP.img

Initial image file ROOT filesystem size (MB) [1734]? 1750

Added space for incremental updates after shrinking (MB) [0]? 50

Create /mnt/netExt500/RPi3/New_images/RSP1a/RPi3-210619-API3-RSTCP.img (y/n)? y
truncate: cannot open '/mnt/netExt500/RPi3/New_images/RSP1a/RPi3-210619-API3-RSTCP.img' for writing: Permission denied

Unable to create image file

pi@rsp1a-rsp-tcp:/mnt/netExt500/RPi3/New_images/RSP1a $ 

the smb.conf file permissions for the share

Code: Select all

[ext]
   comment= Mounted USB Drive
   path=/media/pi/EXT500/
   browseable=Yes
   writeable=Yes
   read only = no
   only guest=no
   create mask=0777
   directory mask=0777
   public=yes
   guest ok = yes

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 10:58 am

Sorted

Code: Select all

pi@HomeVision:/media/pi/EXT500 $ ls -l
total 36
drwxr-xr-x 3 root root  4096 Jun 10 09:39 BiT
drwx------ 2 root root 16384 Jun  8 20:42 lost+found
drwxr-xr-x 4 root root  4096 Jun 15 10:25 PepperMint
drwxr-xr-x 2 root root  4096 Jun 10 19:20 RPi2
drwxr-xr-x 4 root root  4096 Jun 13 10:11 RPi3
drwxr-xr-x 9 root root  4096 Jun 18 20:00 timeshift
pi@HomeVision:/media/pi/EXT500 $ cd RPi3
pi@HomeVision:/media/pi/EXT500/RPi3 $ ls
New_images  Old_Working
pi@HomeVision:/media/pi/EXT500/RPi3 $ ls -l
total 8
drwxr-xr-x 4 root root 4096 Jun 17 19:40 New_images
drwxr-xr-x 2 root root 4096 Jun 10 14:04 Old_Working
pi@HomeVision:/media/pi/EXT500/RPi3 $ sudo chmod -R 777 *
pi@HomeVision:/media/pi/EXT500/RPi3 $ ls -l
total 8
drwxrwxrwx 4 root root 4096 Jun 17 19:40 New_images
drwxrwxrwx 2 root root 4096 Jun 10 14:04 Old_Working
pi@HomeVision:/media/pi/EXT500/RPi3 $ 

User avatar
rpdom
Posts: 18856
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 10:59 am

thagrol wrote:
Sat Jun 19, 2021 10:51 am
You might want to switch to NFS instead of CIFS/Samba. NFS is linux native, has better perofrmance, and full support for linux owner, group, and permissions.
This! Plus NFS is a whole lot easier then CIFS to set up.
Unreadable squiggle

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 11:01 am

thagrol wrote:
Sat Jun 19, 2021 10:51 am

[*]You might want to switch to NFS instead of CIFS/Samba. NFS is linux native, has better perofrmance, and full support for linux owner, group, and permissions.
Thanks..I'll look later..but would that then not screw with access for shares too/from windows machin es..

hmmm..beyond me all of this ....the drive is ext4 format.. and all the shares across the house are smb.

Does Win7/8/10 support NFS ?

User avatar
thagrol
Posts: 5215
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 11:11 am

npaisnel wrote:
Sat Jun 19, 2021 11:01 am
thagrol wrote:
Sat Jun 19, 2021 10:51 am

[*]You might want to switch to NFS instead of CIFS/Samba. NFS is linux native, has better perofrmance, and full support for linux owner, group, and permissions.
Thanks..I'll look later..but would that then not screw with access for shares too/from windows machin es..
Not in my experience. Been running NAS with samba and NFS exports on the same directories for years without problems.
hmmm..beyond me all of this ....the drive is ext4 format.. and all the shares across the house are smb.

Does Win7/8/10 support NFS ?
Don't know about 7 & 8, I think 10 does on the Pro editions. There may well be thrid party drivers but I've neither looked for nor used them.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

User avatar
thagrol
Posts: 5215
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 11:21 am

npaisnel wrote:
Sat Jun 19, 2021 10:57 am
That is one I did not find, no...thank you

I did get it mounted.. but now have permissions issue ..... but off to a wedding now ...or in an hour...
Your permissiosn problems are due to mounting as root and not setting local user, group, or permissions at mount time. CIFS doesn't support any of those. They're set at mount time and cannot be changed.

As mentioned above, from the client's POV everything will be owned by root with a group of root and only root will have write permission.

Try adding file_mode=777,dir_mode=777 to your mount options. It's insecure but should help.
the smb.conf file permissions for the share

Code: Select all

[ext]
   comment= Mounted USB Drive
   path=/media/pi/EXT500/
   browseable=Yes
   writeable=Yes
   read only = no
   only guest=no
   create mask=0777
   directory mask=0777
   public=yes
   guest ok = yes
You've some synonymns in there but looks fine.
Create mask and directory mask only affect files on the server not how the client sees them.
You only need one of writeable and read only
Likewise public and guest ok

editied for tpyos
Last edited by thagrol on Sat Jun 19, 2021 11:47 am, edited 1 time in total.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 11:30 am

thagrol wrote:
Sat Jun 19, 2021 10:51 am

[*]You might want to switch to NFS instead of CIFS/Samba. NFS is linux native, has better perofrmance, and full support for linux owner, group, and permissions.
For the times I'll need to do it...once a month or less..jsut to create an image of the attic server machines...jsut for SD card failure security I ti probably a whole new can of worms that I can leave firmly closed.

I have two Pi's in the attic, one for an RSP1a SDR Receiver and another running HA-Bridge - Heyu and a CM11 power line controller for X-10 home control integration with Alexa.

I just want to do the odd monthly or so image..2-3 gb images of headless desktop free systems jus tin case of failure.


I've got me sets of instructional notes to set it all up , so it is all workmen well.

just done and image-backup using the image backup utilities and it worked. fine.

Maybe once i get the HomeVision server up and running and retire the CM11-Heyu HA-Bridge set up in favour of the TW-523_HomeVision hardware -HVXL and HA_Bridge setp..I coudl look at that..bu too now ..enough on my plate..and this has just worked.. :)

npaisnel
Posts: 229
Joined: Sun Aug 05, 2018 4:23 pm

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 12:51 pm

thagrol wrote:
Sat Jun 19, 2021 11:21 am
npaisnel wrote:
Sat Jun 19, 2021 10:57 am
That is one I did not find, no...thank you

I did get it mounted.. but now have permissions issue ..... but off to a wedding now ...or in an hour...
Your permissiosn problems are due to mounting as root and not setting local user, group, or permissions at mount time. CIFS doesn't support any of those. They're set at mount time and cannot be changed.

As mentioned above, from the client's POV everything will be owned by root with a group of root and only root will have write permission.

Try adding file_mode=777,dir_mode=777 to your mount options. It's insecure but should help.
the smb.conf file permissions for the share

Code: Select all

[ext]
   comment= Mounted USB Drive
   path=/media/pi/EXT500/
   browseable=Yes
   writeable=Yes
   read only = no
   only guest=no
   create mask=0777
   directory mask=0777
   public=yes
   guest ok = yes
You've some synonymns in there but looks fine.
Create mask and directory mask only affect files on the server not how the client sees them.
You only need one of writeable and read only
Likewise public and guest ok

editied for tpyos
It is just the same copy and paste share definition I have been using since I got a pi, in 2018, instructions taken from some tutorial or other.
Change the mount path, name and description and that is it

User avatar
thagrol
Posts: 5215
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Mounting a network HDD on a remote Pi (SOLVED)

Sat Jun 19, 2021 3:55 pm

npaisnel wrote:
Sat Jun 19, 2021 12:51 pm
It is just the same copy and paste share definition I have been using since I got a pi, in 2018, instructions taken from some tutorial or other.
Change the mount path, name and description and that is it
Fair enough. I guess the source you copied it from wasn't aware of those points either.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Return to “Troubleshooting”