A script that mounts and unmounts usb drives.
Made for and tested with raspberry pi and ubuntu.
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.
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]
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)
For quick install, do:
$ ./auto-install.sh
For uninstall, do:
$ ./auto-install.sh -u
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]
For manual uninstall, do:
$ sudo rm /usr/bin/drive-mounter
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.
- 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.
For more usage and abilities, type:
$ drive-mounter -help