Mount an external drive

Comments

18 comments

  • Avatar
    Andy Taylor

    Hey I might be a year late, but I've literally just did this on my Firewalla RED. 

     

    Here is a guide based on the notes I took whilst messing around to get this to work (took a couple of failed attempts and recovering the box back to factory to get it right)

    GUIDE:

    SSH into your Firewalla box and then first update and insall Samba, I used these two commands:

    # sudo apt-get update
    # sudo apt-get install samba samba-common python-glade2 system-config-samba

    Once installed, you then want to find your USB disk (make sure you have plugged it in!).


    # sudo fdisk -l

    This will give you an output, the bottom line should be somthing like
    /dev/sda2 * 8192 15523839 15515648 7.4G b W95 FAT32

    Create a directory for your share:

    # sudo mkdir /media/usb-drive
    # sudo chmod 744 /media/usb-drive

    Now mount the drive (replace sda2 with whatever your drive comes up as from the fdisk -l command ran earlier):

    mount /dev/sda2 /media/usb-drive/

    test it worked by typing

    # mount

    If no output, it didn't work.

    To see whats on the drive,

    # cd /media/usb-drive

    Type the below to get a full listing

    # ls

    OK now back to the Samba set up,

    Create a permission for the sharing:
    # sudo chown -R nobody:nogroup /media/usb-drive/
    # sudo chmod -R 0775 /media/usb-drive/

    Copy the Samba default configuration file to a backup (in case you need to revert)

    # sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup

    Edit Samba configuration file

    # sudo vi /etc/samba/smb.conf

    Add the next lines to Samba configuration file (press "i" to enable input/edit):

    -----------------------------------------------------

    [global]
    workgroup = WORKGROUP
    server string = Samba Server %v
    netbios name = Firewalla-Box
    security = user

    [SambaShare]
    Comment = Samba Shared Directory
    path = /media/usb-drive
    writable = yes
    guest ok = yes
    read only = no
    force user = nobody

    -----------------------------------------------------

     

    Press Escape then save by typing

    :wq

    Restart Samba

    # sudo service smbd restart

     

    You should be good to log into the share

    type your path in file explorer (replace x with Firewalla's IP)

    \\192.168.1.x\sambashare

     

    1
    Comment actions Permalink
  • Avatar
    Paul van Laarhoven

    Thanks Andy!! Works like a charm!

    It seems the USB drive has to be formatted in ext4, otherwise the chown command doesn't work.

    0
    Comment actions Permalink
  • Avatar
    Alejandro Sánchez Márquez

    Wonderful, will be doing it. I already have a NAS but this can serve well for another purpose while being protected under the Firewalla umbrella.

    0
    Comment actions Permalink
  • Avatar
    Alexander Lai

    Can anyone take a picture or draw something to illustrate how the physical connections should be done before getting on?

    0
    Comment actions Permalink
  • Avatar
    Andy Taylor

    Here is a better/cleaner guide with screens. Just tried it it works fine.

     

    https://hackmypi.com/NASpi.php

    0
    Comment actions Permalink
  • Avatar
    Chris Hewitt

    You guys are working way too hard. Just use sshfs.

    I’m not a Samba fan - why install something new when the functionality already exists. But yes, there are times and places where samba is great - but not on tight lil Firewallas.

    SSHFS (SSH Filesystem) is a filesystem client based on FUSE for mounting remote directories over an SSH connection. SSHFS is using the SFTP protocol, which is a subsystem of SSH and it is enabled by default on most SSH servers.

    When compared to other network file system protocols such as NFS and Samba the advantage of SSHFS is that it does not require any additional configuration on the server side. To use SSHFS you only need SSH access to the remote server - which we already have.

    Because SSHFS uses SFTP , all transmitted data between the server and the client is encrypted and decrypted. This results with a slightly degraded performance compared to NFS, and higher CPU usage on the client and server.

    0
    Comment actions Permalink
  • Avatar
    Firewalla

    A quick note, CPU, and memory on these units (especially on the red/blue) are scarce resources, so use them wisely :)

     

    0
    Comment actions Permalink
  • Avatar
    Chris Hewitt

    And that’s why I ask for a waiver of liability on some of my posts :-)

    0
    Comment actions Permalink
  • Avatar
    Bill Bradstreet

    I had this all set up and working, but things disappeared.

    I cannot even find the /etc/samba folder, for instance. The directory I created to mount (usb-drive) no longer exists either.

    Does this sort of configuration get deleted when I reboot my FW Gold?

    0
    Comment actions Permalink
  • Avatar
    Firewalla

    Gold reboot always wipe things out.  You can put a script in https://help.firewalla.com/hc/en-us/articles/360054056754--Firewalla-Gold-Customized-Scripting-

     

    0
    Comment actions Permalink
  • Avatar
    Bill Bradstreet

    Thanks for the quick response. Am I correct in assuming I will have to reinstall Samba each time then as well?

    0
    Comment actions Permalink
  • Avatar
    Firewalla

    There are two ways

    1. reinstall everything in that script

    2. Use a docker container to run samba

    Docker container is probably the best way for this. 

    1
    Comment actions Permalink
  • Avatar
    koko_puff

    Do we have guide to run Samba on a docker?

    0
    Comment actions Permalink
  • Avatar
    Chris Hewitt

    No, but feel free to write one. :-)

    Start here. 
    https://hub.docker.com/r/servercontainers/samba

    Use this as an example. 
    https://help.firewalla.com/hc/en-us/community/posts/1500001199002-Cloudflare-DDNS-Docker-Setup-on-FWG

    0
    Comment actions Permalink
  • Avatar
    Bill Bradstreet

    I have a script that I can run already that does everything to get samba up and running. It works fine when I run it manually. But I see no evidence of it running when my Gold reboots. I started looking at using Docker, but I have no experience with it and don't understand the paradigm either, so I'd prefer to us my script since I think I'm at 99%.

    I even chmod'd my start.sh file up to 777, so anybody can do anything with it at this point, yes?

    What am I missing??

    0
    Comment actions Permalink
  • Avatar
    Best98

    Would it be possible to detail a bit more the Docker part of Samba please ?

    @Bill.. you may want to put your sh script into startup folder 

    /home/pi/.firewalla/config/post_main.d/
    0
    Comment actions Permalink
  • Avatar
    Bill Bradstreet

    @Best98 ... yup, that's where I have my script. I still haven't figured out Docker. I've tried on a test RPi as well, so luck adding to the knowledgebase on that from me yet!

    0
    Comment actions Permalink
  • Avatar
    Bill Bui

    Using Ubuntu (or other Linux distort) using the version of SMB included wih the distro
    will use less resources than the Docker version. 

    The Docker version has other benefits. 

    0
    Comment actions Permalink

Please sign in to leave a comment.