Mounting storage drives on Debian can mean several things. Sometimes you have a NAS system like a Synology or QNAP that has samba shares that you wish to access on Debian. You can do that by mounting the samba share in a folder on Debian. Alternatively you can mount hard drives on Debian that are formatted in NTFS. This guide will cover mounting drives for your HTPC home media server: samba shares on windows machines and local NTFS formatted hard drives connected via usb or SATA to your box running Debian Wheezy, Jessie or later.
Mount Samba on Debian
This is for mounting a network drive samba share. This can be a drive or folder shared on a Windows machine you want to access from Debian.
Create the mount point, in linux you create a folder that you want to act as a symbolic link for the network drive
sudo mkdir -p /path/of/folder/on/linux
Make sure you change the ownership of the folder to your regular user
sudo chown -R user:user /path/of/folder/on/linux
First make sure cifs-utils is installed
sudo apt-get update sudo apt-get install cifs-utils smbclient -y
Now make sure you can access the samba share, replace remotemachinenameorip with your server’s IP with the samba share and sharename with the name of the samba share on the server. Change username and password to match the credentials for the samba share.
smbclient \\\\remotemachinenameorip\\sharename -U usernameonwindowsmachine passwordonwindowsmachine
If you did not get an error all is well try and list the folder’s contents
Now we mount the network drive, remember your network drives are case sensitive
mount -t cifs //networkip/share /local/linux/folder -o username=usernameonwindowsmachine,password=passwordforwindowsmachine
Make this network drive automount on boot
Fire up WInSCP, browse to and open /etc/fstab and add the following line making sure the uid and gid matches the output of
//networkip/share /local/linux/foldermountpoint cifs defaults,uid=1000,gid=1000,username=usernameonwindows,password=passwordonwindows 0 0
Make sure you press enter after pasting this line or you will get an error on boot
Mount NTFS Drive on Debian
Make sure you have ntfs-3g installed
sudo apt-get update sudo apt-get install ntfs-3g -y
Now determine the sda path of the usb drive.
Plug in the usb drive and you will see some messages on the debian box
[ xxx.xxxx] sdc 3:0:0:0: [sdc] Assuming drive cache: write through [ xxx.xxxx] sdc 3:0:0:0: [sdc] No Caching mode page found
At this point it is safe to assume that the drive is sdc1 (but see below)
Create a mount point to act as a symbolic link for the drive
mkdir -p /place/to/mount
Change the ownership of the mount path
sudo chown -R user:user /place/to/mount
Mount the drive, sdc1 should be replaced with the sdx you found when you plugged in the drive
sudo mount -t ntfs-3g /dev/sdc1 /place/to/mount
Now you can make it automount on boot
Fire up WinSCP, browse to and open /etc/fstab and add the following line
/dev/sdc1 /place/to/mount ntfs-3g rw,uid=1000,gid=1000,dmask=0002,fmask=0003 0 0
If on reboot the drive fails to mount it may be because linux assigned it a different letter when it was plugged in.
Since you will probably be keeping this drive plugged in at boot, you can go to the /dev folder and find how linux is assigning it
cd /dev/ && ls
You will get a screen like this. sda is used for the primary hard drive so look for the first sdb or sdc that is unassigned. Here it is sdb1.
Go back and edit /etc/fstab and change the sdx1 to the correct identifier you just found.