问题简述:
私有云新建一台ECS服务器,系统盘为100G。数据盘为1000G,但是系统盘只是在云平台进行绑定,并未挂载到服务器上,故需要进行挂载操作。
注:一般情况下会先进行分区,然后进行挂载,但此次我作为数据盘使用,
1、查看已有磁盘,可以看到有一块/dev/vdb数据盘。
[root@ecs-e50ota-0018 ~]# fdisk -l
Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ee330
Device Boot Start End Blocks Id System
/dev/vda1 2048 8390655 4194304 82 Linux swap / Solaris
/dev/vda2 * 8390656 209715166 100662255+ 83 Linux
Disk /dev/vdb: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
2、查看磁盘分区
[root@ecs-e50ota-0018 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 100G 0 disk
├─vda1 253:1 0 4G 0 part [SWAP]
└─vda2 253:2 0 96G 0 part /
vdb 253:16 0 1T 0 disk
开始分区-格式化文件系统-挂载
1、执行命令fdisk /dev/xvde,进入fdisk模式,开始对新增数据盘执行分区操作。
![](https://img.haomeiwen.com/i26090942/b4de3c6f0d4bf8d4.png)
2、执行以下命令,将新建分区文件系统设为系统所需格式
[root@ecs-e50ota-0018 ~]# mkfs.xfs /dev/vdb1
![](https://img.haomeiwen.com/i26090942/981ac0f8f3858883.png)
3、新建/mnt/data 目录,并挂载分区
[root@ecs-e50ota-0018 ~]# mkdir -p /mnt/data
[root@ecs-e50ota-0018 ~]# mount /dev/vdb1 /mnt/data/
查看挂载:
![](https://img.haomeiwen.com/i26090942/3378bfa5bfefa624.png)
4、挂载好的磁盘需要设置开机自动挂载,推荐使用UUID来配置自动挂载数据盘。
先执行命令blkid /dev/xvde1,查询磁盘分区的UUID:
[root@ecs-e50ota-0018 ~]# blkid /dev/vdb1
/dev/vdb1: UUID="322e0ea5-d312-46d3-9efe-083d6f961abb" TYPE="xfs"
然后编辑/etc/fstab,在末尾增加一行,把UUID和目录换成你自己的即可。
UUID=322e0ea5-d312-46d3-9efe-083d6f961abb /mnt/data xfs defaults 0 0
![](https://img.haomeiwen.com/i26090942/5e939b00a250e195.png)
最后,重启机器,使用df -TH查看挂载情况,如果能看到新增的磁盘挂载信息则大功告成。
网友评论