標籤:mnt linux shell unix
#!/bin/bash
:<<NNNNNNN
‘
HISTORY: 2013-01-05 11:17 FRI
FUNCTION: Oracle VM VirtualBox中掛在所在Windows的各個分區
SYNOPSIS: mnt.v.windows.hardisk [C | D | E | ....]
-> Optiplex380的Windows分區為C,D,E.
-> ./mntvwh C 掛載C盤
-> ./mntvwh D 掛載D盤
-> ./mntvwh E 掛載E盤
-> ./mntvwh H 掛載移動硬碟
-> 尋找移動硬碟具體的位置
-> sudo fdisk -l
-> VM中配置的檔案夾命名為: 盤符_ip最後一位
-> eg: E_138 [ip]
->
DESCRIPTION: On x86_64
->
->
NSVERSION: v7.1.9.8.2013-mon-x86_64
BUGS:
-> 執行指令碼時,若是報出以下錯誤: [/sbin/mount.vboxsf: mounting failed with the error: No such device]
-> 解決方案如下:
-> cd /media/VBOXADDITIONS_4.2.12_84980/
-> sudo ./VBoxLinuxAdditions.run
->
‘
NNNNNNN
mntDIR=~/Music/$1/
function mntWindowsDisc() {
sudo mount -t vboxsf -o iocharset=utf8,uid=${USER},gid=${USER},umask=077 $1_138 ${mntDIR}
}
#mount移動硬碟時需要先判斷硬碟的位置
#需手動,自動以後完成
#/dev/sda2
#/dev/sdb1
#/dev/sdb2
#/dev/sdc1
function mntHardisk(){
sudo mount -t ntfs /dev/sda2 ${mntDIR} -o uid=${USER},gid=${USER},umask=022,force
# sudo chown -R ${USER}:${USER} ${mntDIR}
# sudo chmod -R 755 ${mntDIR}
}
case $1 in
"C") mntWindowsDisc C ;;
"D") mntWindowsDisc D ;;
"E") mntWindowsDisc E ;;
"H") mntHardisk H ;;
*) echo "Not Support, You Input is Not Correct.." ;;
esac
#if [ $1 == "E" ]; then
# mount_windows_folder E
#elif [ $1 == "D" ]; then
# mount_windows_folder D
#elif [ $1 == "C" ]; then
## mount_windows_folder C
#elif [ $1 == "H" ]; then
# mount_hardisk
#else
# echo "Not Support, You Input is Not Correct.."
#fi
本文出自 “andyhdchoice” 部落格,請務必保留此出處http://andyhdchoice.blog.51cto.com/1521623/1548798
小例子: Oracle VM VirtualBox中掛載所在Windows的各個分區