Skip to content

A Simple Script That Mounts And Unmounts Usb Drives For Raspberry Pi And Linux/Ubuntu

Notifications You must be signed in to change notification settings

WestleyK/drive-mounting-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple script for mounting and un-mounting external drives

A script that mounts and unmounts usb drives.
Made for and tested with raspberry pi and ubuntu.

Better script comming soon!


Quick start:

First download if you havent already:
$ git clone https://github.com/WestleyK/drive-mounting-script.git

Then you can install the drive-mounter command:
$ ./auto-install.sh
Now you should be able to type drive-mounter insted of running the script.

For more info on installing or un-installing, click here.

User inerface:

After you run the command you can select a number that corresponds with the drive,
For example, you want to mount the first option, so type 1

$ drive-mounter
https://github.com/WestleyK/drive-mounting-script



1:/dev/sda1  *     8064 30277631 30269568 14.4G  c W95 FAT32 (LBA)
2:/dev/sdb1           2 126353407 126353406 60.3G  b W95 FAT32

what would you like to mount or un-mount? [1-8]

Then you can select to (m)mount, (u)un-mount or (r)remount? [m,u,r]
See, simple! :)

$ drive-mounter
https://github.com/WestleyK/drive-mounting-script



1:/dev/sda1  *     8064 30277631 30269568 14.4G  c W95 FAT32 (LBA)
2:/dev/sdb1           2 126353407 126353406 60.3G  b W95 FAT32

what would you like to mount or un-mount? [1-8]1

/dev/sda1

(m)mount, (u)un-mount or (r)remount?  [m,u,r]

Option menu:

Here is all the options avalable:

$ drive-mounter -help
	usage: driver-mounter [-option]
-h | -help | --help (display help menu)
-a | -all (unmount all drives)
-d (display all drives, mounted or not)
-m (mount drive only if there one)
-p (temporally change the mount point when mounting drive) (defalt:/media/pi)
-r (remount the drive, this only works if one drive is connected)


Install and uninstall:

For quick install, do:
$ ./auto-install.sh

For uninstall, do:
$ ./auto-install.sh -u

Manually install:

For manual install, do:
$ sudo chmod 777 raspberry-pi/drive-mounter && sudo cp -i raspberry-pi/drive-mounter /usr/bin/ for raspberry pi

Or for linux/ubuntu, do:
$ sudo chmod 777 linux-ubuntu/drive-mounter[-root] && sudo cp -i linux-ubuntu/drive-mounter[-root]

Manuall uninstall:

For manual uninstall, do:
$ sudo rm /usr/bin/drive-mounter


Changing the mount point:

If you just want to change the mount point temporally:
Then do $ drive-mounter -p. Otherwise, the instructions are below.

By defalt the sctipt will mount to /media/pi for raaspberry pi, and /media/usb-drives for linux/ubuntu.
You can easily change this by editing the driver-mounter.
For raspberry pi:$ vim raspberry-pi/drive-mounter, then uninstall and reinstall.
Or $ sudo vim /usr/bin/drive-mounter if you already installed it.

For linux/ubuntu:$ vim linux-ubuntu/drive-mounter, or edit the root script if thats what you will use.
Or $ sudo vim /usr/bin/drive-mounter if you already instelled it.


Known bugs:

  • cant uninstall linux-ubuntu/drive-mounter-root by script, have to uninstall manually.
  • need sudo to write to usb drive (linux/ubuntu only)
  • "-d" option does not work properly for linux/ubuntu.


More usage:

For more usage and abilities, type:
$ drive-mounter -help



End README