日期:2014-05-16  浏览次数:20601 次

Linux VPS新硬盘分区与挂载教程

Linux VPS新硬盘分区与挂载教程

通过此教程对未启用的硬盘进行分区并挂载,可以确保通过DiyVM面板重装系统是不丢失挂载分区的数据!

?

先通过fdisk -l查看目前磁盘分区状况

?[root@MyVPS ~]#?fdisk -l
Disk /dev/xvda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 13 104391 83 Linux
/dev/xvda2 14 1044 8281507+ 8e Linux LVM

Disk /dev/xvdb:?23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System

?我们可以看到/dev/xvdb容量有23.6G,而且没有分区,接下来我们对它进行分区和挂载
?

# fdisk /dev/xvdb

?[root@MyVPS ~]#?fdisk /dev/xvdb
The number of cylinders for this disk is set to 2871.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

输入n新建分区
Command (m for help):?n
Command action
e extended
p primary partition (1-4)
p

?

--------------------------------------------------

? 选择分区类型?
?
??? 这里有两个选项:?
??? p: 主分区 linux上主分区最多能有4个?
??? e: 扩展分区 linux上扩展分区只能有1个,扩展分区创建后不能直接使用,还要在扩展分区上创建逻辑分区。?
这里我选择的p。

--------------------------------------------------

/dev/xvdb中第1个分区

--------------------------------------------------

选择分区个数?