小例子: Oracle VM VirtualBox中掛載所在Windows的各個分區

來源:互聯網
上載者:User

標籤: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的各個分區

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.