阿里云ECS Linux服务器如何实现挂载

Linux Alan 8年前 (2016-05-13) 4242次浏览 0个评论 扫描二维码

阿里云上购买服务器可在系统盘之外添加数据盘,但Linux不像Windows那样可以在后台直接挂载,而是需要手动执行挂载操作:

第一、检查阿里云服务器数据盘情况

利用fdisk -l命令,检查当前VPS的数据硬盘情况。

阿里云ECS Linux服务器如何实现挂载

这里我们可以看到有100GB数据盘没有挂载,肯定需要利用起来的。

第二、挂载阿里云数据硬盘

输入”fdisk /dev/xvdb“,然后根据下图的提示,输入n,p,1(Alan在挂载时显示为2-5,因此输入2),回车,回车,wq,保存退出。

阿里云ECS Linux服务器如何实现挂载

完毕之后,我们在输入fdisk -l,已经可以看到数据盘100GB已经被分区。

第三、格式化分区及挂载目录

A – 格式化挂载数据硬盘分区

mkfs.ext3 /dev/xvdb1

B – 创建目录挂载

如果我们安装的是LNMP/AMH一键包,那默认是在HOME目录下;如果是安装WDCP面板,那需要安装在WWW目录下,我们需要先检查是否有对应的目录,没有需要mkdir创建目录。(Alan操作时对应盘为/dev/xvdb2)

echo '/dev/xvdb1  /home ext3    defaults    0  0' >> /etc/fstab

对应上面的home目录是我们确定的路径(请务必在挂载前备份好home目录中的内容),如果是WWW那就需要更换。

第四、执行mount -a挂载

输入mount -a命令,直接挂载,然后df -h检查看看是否成功。

阿里云ECS Linux服务器如何实现挂载

这样,我们可以看到阿里云服务器ECS已经挂载完毕,我们可以放心的对安装环境包。

fdisk参数详解:

a Toggles a flag indicating if the partition is bootable
b Edits the disklabel used by BSD Unix systems
c Toggles the DOS compatibility flag
d Deletes the partition
l Lists the available partition types
m Displays the command options
n Adds a new partition
o Creates a DOS partition table
p Displays the current partition table
q Quits without saving changes
s Creates a new disklabel for Sun Unix systems
t Changes the partition system ID
u Changes the storage units used
v Verifies the partition table
w Writes the partition table to the disk
x Advanced functions

参考链接:http://www.laozuo.org/5080.html

喜欢 (0)
[]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址