ubuntu 12.04 server 挂载硬盘

买的虚拟机添加硬盘需要手动挂载,下面列下简单步骤,作为记录:

1、查看下当前文件系统

[root@VM_28_226_centos~]#df

Filesystem1K-blocksUsedAvailableUse%Mountedon

/dev/vda182542401099340673560815%/

只有一个/dev/vda1挂在了根下边,也就是系统软件装在这里

2、查看下当前硬盘情况

[root@VM_28_226_centos~]#fdisk-l

Disk/dev/vda:8589MB,8589901824bytes

255heads,63sectors/track,1044cylinders

Units=cylindersof16065*512=8225280bytes

Sectorsize(logical/physical):512bytes/512bytes

I/Osize(minimum/optimal):512bytes/512bytes

Diskidentifier:0xcd6e8236

DeviceBootStartEndBlocksIdSystem

/dev/vda1*110448385898+83Linux

Disk/dev/vdb:268.4GB,268435456000bytes

16heads,63sectors/track,520126cylinders

Units=cylindersof1008*512=516096bytes

Sectorsize(logical/physical):512bytes/512bytes

I/Osize(minimum/optimal):512bytes/512bytes

Diskidentifier:0x00000000

Disk/dev/vdbdoesn'tcontainavalidpartitiontable

Disk/dev/vdc:2147MB,2147483648bytes

16heads,63sectors/track,4161cylinders

Units=cylindersof1008*512=516096bytes

Sectorsize(logical/physical):512bytes/512bytes

I/Osize(minimum/optimal):512bytes/512bytes

Diskidentifier:0x00000000

Disk/dev/vdcdoesn'tcontainavalidpartitiontable

看到一个盘,/dev/vdb,270G。现在格式化下。

3、格式化

[root@VM_28_226_centos~]#mkfs-text4/dev/vdb

mke2fs1.41.12(17-May-2010)

Filesystemlabel=

OStype:Linux

Blocksize=4096(log=2)

Fragmentsize=4096(log=2)

Stride=0blocks,Stripewidth=0blocks

16384000inodes,65536000blocks

3276800blocks(5.00%)reservedforthesuperuser

Firstdatablock=0

Maximumfilesystemblocks=4294967296

2000blockgroups

32768blockspergroup,32768fragmentspergroup

8192inodespergroup

Superblockbackupsstoredonblocks:

32768,98304,163840,229376,294912,819200,884736,1605632,2654208,

4096000,7962624,11239424,20480000,23887872

Writinginodetables:done

Creatingjournal(32768blocks):done

Writingsuperblocksandfilesystemaccountinginformation:done

Thisfilesystemwillbeautomaticallycheckedevery25mountsor

180days,whichevercomesfirst.Usetune2fs-cor-itooverride.

-t是指分区类型这里用ext4

4、把磁盘挂载到/edx

mount/dev/vdb/edx

[root@VM_28_226_centos~]#df

Filesystem1K-blocksUsedAvailableUse%Mountedon

/dev/vda182542401099384673556415%/

/dev/vdb2580309801917082447320721%/edx

5、设置开机自动挂载

vim/etc/fstab

添加一条

/dev/vdb/edxext4noatime,acl,user_xattr10

(fstab的文件格式,以后记录)

相关推荐