首先在virtualBox设置里,设置->介质->添加->选add harddisk,在弹出的对话框里选择新建,点击下一步,选择动态扩展(固定的分小了,又要在分,麻烦),点击下一步,选择大小,点击下一步,完成。【也可以】
接下来就要在Ubuntu里做相关设置。
进入终端模式
输入sudo fdisk /dev/sdb
会提示
The number of cylinders for this disk is set to 1365.
Command (m for help):
按m看help
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)
按n创建分区,按p是查看分区
Command (mfor help): n
Commandaction
eextended
p primarypartition (1-4)
e是创建扩展分区
p是创建主分区
按p
p
Partitionnumber (1-4):1
Firstcylinder (1-1044, default 1):1
Lastcylinder or +size or +sizeM or +sizeK (1-1044, default1044):1044
Command (mfor help): w
按w保存退出
格式化开始,我选择的是ext3格式(文件系统类型可在 cd /sbin下查看)
sudo mkfs -text3 /dev/sdb1
然后我把这个硬盘挂在~/src下就可以了
cd~/src (cd /usr/src)
sudo mkdirsdb1
sudo mount/dev/sdb1 ~/src/sdb1
sudodf
df命令是查看的意思
文件系统 1K-块 已用可用 已用% 挂载点
/dev/sda1 3842376 2822092 825096 78% /
tmpfs 190020 0 190020 0% /lib/init/rw
varrun 190020 120 189900 1% /var/run
varlock 190020 0 190020 0% /var/lock
udev 190020 152 189868 1% /dev
tmpfs 190020 76 189944 1% /dev/shm
lrm