Skip to content

Instantly share code, notes, and snippets.

@matdombrock
Created May 12, 2016 04:49
Show Gist options
  • Save matdombrock/59686b9206824fc4cb26b2f85cd90c84 to your computer and use it in GitHub Desktop.
Save matdombrock/59686b9206824fc4cb26b2f85cd90c84 to your computer and use it in GitHub Desktop.
A Bash script that makes it easy to mount an exteral drive to a server or other linux OS without mounting tools.
#!/bin/bash
lsblk
echo
read -p "What do you want to mount?(sdb1, sdb2 ect?): "
echo
drive=$REPLY
read -p "Where do you want to mount it?(media/<LOCATION>): "
echo
target=$REPLY
cd /.
sudo mkdir -p media/$target
sudo mount -t ntfs /dev/$drive /media/$target
cd media/$target
ls
echo 'boom'

Copy this file to your home folder.

Change its permisions to make it executable with sudo chmod 700 easyMount.sh

Execute the script with . ./easyMount.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment