Linux--自動掛載win目錄

來源:互聯網
上載者:User

標籤:

1. 在ubuntu下查看windows磁碟資訊, Ctrl + Alt + t開啟終端, 輸入以下命令:
sudo fdisk -l  
資訊如下:
[email protected]:~$ sudo fdisk -l  [sudo] password for cryhelyxx:     Disk /dev/sda: 1000.2 GB, 1000204886016 bytes  255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors  Units = 扇區 of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 4096 bytes  I/O size (minimum/optimal): 4096 bytes / 4096 bytes  Disk identifier: 0xf7b8cd85       裝置 啟動      起點          終點     塊數   Id  系統  /dev/sda1   *          63   251674289   125837113+   7  HPFS/NTFS/exFAT  Partition 1 does not start on physical sector boundary.  /dev/sda2       251674351  1848662464   798494057    f  W95 擴充 (LBA)  Partition 2 does not start on physical sector boundary.  /dev/sda3      1952178176  1953523711      672768   82  Linux 交換 / Solaris  /dev/sda4      1848664064  1952177735    51756836   83  Linux  /dev/sda5       251674353   677412854   212869251    7  HPFS/NTFS/exFAT  Partition 5 does not start on physical sector boundary.  /dev/sda6       677412918  1103151419   212869251    7  HPFS/NTFS/exFAT  Partition 6 does not start on physical sector boundary.  /dev/sda7      1103151483  1528889984   212869251    7  HPFS/NTFS/exFAT  Partition 7 does not start on physical sector boundary.  /dev/sda8      1528890048  1848662464   159886208+   7  HPFS/NTFS/exFAT    Partition table entries are not in disk order  [email protected]:~$   

 

 
可知本人的ubuntu下的windows的分區有sda1, sda5, sda6, sda7, sda8, 因為本人的windows分區有C、D、E、F、G盤
2. 接著建立要掛載的磁碟的檔案夾, 依次輸入以下命令來建立對應的檔案夾:
sudo mkdir /media/C  sudo mkdir /media/D  sudo mkdir /media/E  sudo mkdir /media/F  sudo mkdir /media/G  

 

 
3. 修改fstab檔案, 路徑:/etc/fstab, 根據分區資訊來實現ubuntu開機自動掛載windows硬碟分區
(1) 開啟fstab檔案, 執行命令:
 
sudo vim /etc/fstab  

 

其中, vim是編輯器, 當然也可以gedit, sublime等常用的編輯器來開啟fstab檔案
  
(2) 開啟fstab檔案後, 在其最後添加以下資訊(ps:這裡添加的資訊要與你windows的磁碟資訊對應, 即與上面的資訊要一致):
 
/dev/sda1 /media/C ntfs-3g silent,umask=0,locale=zh_CN.utf8 0 0  /dev/sda5 /media/D ntfs-3g silent,umask=0,locale=zh_CN.utf8 0 0  /dev/sda6 /media/E ntfs-3g silent,umask=0,locale=zh_CN.utf8 0 0  /dev/sda7 /media/F ntfs-3g silent,umask=0,locale=zh_CN.utf8 0 0  /dev/sda8 /media/G ntfs-3g silent,umask=0,locale=zh_CN.utf8 0 0  

 

  
4. 在fstab檔案添加完資訊後儲存退出, 重啟電腦, 進入ubuntu系統, 就可以看到看到windows磁碟自動掛載成功, 如下:

 
5. 如果重啟後還是無法自動掛載, 並且點擊windows磁碟彈出無法掛載磁碟, 要以root身份掛載, 則執行以下命令賦予fstab檔案許可權:
sudo chmod u+rwx /etc/fstab  
其中上面參數u表示目前使用者, rwx表示讀/寫/運行許可權
 
6. 重啟電腦以生效, 則可以實現在ubuntu系統下實現windows磁碟分割的自動掛載。 OK, Enjoy it!!!

Linux--自動掛載win目錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.