日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Ubuntu >内容正文

Ubuntu

在VirtualBox中的Ubuntu中添加新硬盘

發布時間:2025/5/22 Ubuntu 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在VirtualBox中的Ubuntu中添加新硬盘 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

在VirtualBox中的Ubuntu中添加新硬盤

VitrualBox是不允許更改重置硬盤大小的,所以當硬盤不足時,只能添加新硬盤。

步驟如下:

1. 關閉Ubuntu系統,打開VistualBox,"設置"->"存儲"->“添加虛擬硬盤”

2. 啟動Ubuntu系統,操作命令如下:
#1 sudo fdisk -l // 查看現有系統磁盤空間
----------------------------------------------------------------------------
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000af383

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1244 9992398+ 83 Linux
/dev/sda2 1245 1305 489982+ 5 Extended
/dev/sda5 1245 1305 489951 82 Linux swap / Solaris

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table
----------------------------------------------------------------------------

以上信息可以看到新增加的磁盤空間 /dev/sdb ,這里我們需要給新的磁盤空間分區。
#2 fdisk /dev/sdb
#3 Command (m for help): m // 鍵入m,可看到幫助信息
打印結果如下:
----------------------------------------------------------------------------
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
----------------------------------------------------------------------------
#4 Command (m for help): n
打印結果如下:
----------------------------------------------------------------------------
Command action
e extended
p primary partition (1-4)
----------------------------------------------------------------------------

鍵入:p,選擇添加主分區;
鍵入:1,選擇主分區編號為1, 這樣創建后的主分區為sdb1;

#5 First Cylinder(1-1014,default 1): 1 // 第一個主分區起始的磁盤塊數
#6 Last cylindet or +siza or +sizeM or +sizeK: +1024MB // 可以是以MB為單位的數字或者以磁盤塊數,這里我們輸入+1024MB表示分區大小為1G。

這樣我們就創建完一個分區,如果要創建更多分區可以照上面的步驟繼續創建。
最后,鍵入:w,保存所有并退出,完成新磁盤的分區。

4. 格式化磁盤分區
#7 sudo mkfs -t ext3 /dev/sdb1 // 用ext3格式對 /dev/sdb1 進行格式化

5. 掛載分區
#8 sudo mkdir /data // 創建新的掛載點
#9 sudo mount /dev/sdb1 /data // 將新磁盤分區掛載到 /data 目錄下
#10 sudo df // 查看掛載結果

6. 開機自動掛載
#11 vi /etc/fstab // 修改 /etc/fstab 文件
在 /etc/fatab 文件中,添加如下內容:
/dev/sdb1 /data ext3 defaults 1 2


轉載于:https://my.oschina.net/u/270991/blog/613267

總結

以上是生活随笔為你收集整理的在VirtualBox中的Ubuntu中添加新硬盘的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。