Mounting Windows Drives to your Linux/Unix OS using the Samba/SMB File System (smbfs)

Category: Software and Systems Engineering
Author: Sean O'Donnell
Thu, Feb. 20th, 2003 @ 2:20:22 (MST)

If you are running Linux on your local area network (LAN), there may come a time when you need to mount specific Hard Disk Drive (HDD) Partitions from a pc on your network that is running the Windows Operating System.

The first step you will need to do, is to create a destination directory on your linux machine, which is where you will store your mounted windows hdd partitions.

 mkdir /windows 

The command above will create a base directory '/windows' on your linux machine, which will be used as a destination for all mounted hdd partitions from your windows machine(s).

Since you may have more than 1 computer on your lan that runs on the Windows Operating System, you may want to create specific folders for each pc.

In this case, I want to create a folder for the computer named 'drone2'.

 mkdir /windows/drone2 

Now I have a base-directory to store all mounted hdd partitions from the windows machine named 'drone2'.

Since the windows machine named 'drone2' has multiple HDD Partitions, I want to create individual mount-point directories on the linux machine, so that each mounted partition from the windows machine, has it's own destination directory.

# create a directory to mount the C drive from the pc 'drone2' 
mkdir /windows/drone2/c
# create a directory to mount the D drive from the pc 'drone2'
mkdir /windows/drone2/d
# create a directory to mount the E drive from the pc 'drone2'
mkdir /windows/drone2/e

This will create the destination directories for each hdd partition that will be mounted from windows.

Now that we have the destination directories created, we can go ahead an begin mounting the hdd partition from the windows machine 'drone2'.

mount -t smbfs //drone2/C$ /windows/drone2/c -o username=my-pc-username -o password=my-pc-passwd 
mount -t smbfs //drone2/D$ /windows/drone2/d -o username=my-pc-username -o password=my-pc-passwd
mount -t smbfs //drone2/E$ /windows/drone2/e -o username=my-pc-username -o password=my-pc-passwd

The command examples above were tested with mount-2.11z on Slackware Linux v9.0.

You will of coarse need to edit the name of the machine, username, and password in order for this to work correctly.

You will also need to ensure that the drives you are attempting to mount, have proper sharing permissions to allow such access.

Copyleft (<) 1998-2019