新增数据盘

第一步:在阿里云创建云盘(必须和挂载的服务器是一个区域一个分区)

            购买完之后在阿里云上面先挂载

第二步:创建磁盘分区

[root@iZj6c45wku1lv9c4w5dlpqZ ~]# fdisk -l 查看现有磁盘分区

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00020f03

Device Boot Start End Blocks Id System
/dev/vda1 * 1 5222 41940992 83 Linux

Disk /dev/vdb: 128.8 GB, 128849018880 bytes
16 heads, 63 sectors/track, 249660 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

对未分区磁盘进行分区

[root@iZj6c45wku1lv9c4w5dlpqZ ~]# fdisk /dev/vdb 
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x78851959.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): m 查看帮助
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)

Command (m for help): n 新增加分区
Command action
e extended
p primary partition (1-4)
p 基本分区
Partition number (1-4): 1 分区编号
First cylinder (1-249660, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-249660, default 249660):
Using default value 249660

Command (m for help): w 写入修改
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@iZj6c45wku1lv9c4w5dlpqZ ~]#
[root@iZj6c45wku1lv9c4w5dlpqZ ~]# fdisk -l 查看新建分区

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00020f03

Device Boot Start End Blocks Id System
/dev/vda1 * 1 5222 41940992 83 Linux

Disk /dev/vdb: 128.8 GB, 128849018880 bytes
16 heads, 63 sectors/track, 249660 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x78851959

Device Boot Start End Blocks Id System
/dev/vdb1 1 249660 125828608+ 83 Linux

 

 将新建分区格式为ext4格式


[root@iZj6c45wku1lv9c4w5dlpqZ ~]# mkfs -t ext4 /dev/vdb1 将新建分区格式为ext4格式
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
7864320 inodes, 31457152 blocks
1572857 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
960 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@iZj6c45wku1lv9c4w5dlpqZ ~]# fdisk -l 查看分区列表

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00020f03

Device Boot Start End Blocks Id System
/dev/vda1 * 1 5222 41940992 83 Linux

Disk /dev/vdb: 128.8 GB, 128849018880 bytes
16 heads, 63 sectors/track, 249660 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x78851959

Device Boot Start End Blocks Id System
/dev/vdb1 1 249660 125828608+ 83 Linux


第三步:挂载上要指定的目录(当挂载的目录下面有数据的时候把数据移出再挂载,否则挂载上目录下面会没有数据)


[root@iZj6c45wku1lv9c4w5dlpqZ ~]# mount /dev/vdb1 /mnt 将分区挂载到/mnt下
[root@iZj6c45wku1lv9c4w5dlpqZ ~]#

 

第四步:可以设置开机自动挂载


[root@iZj6c45wku1lv9c4w5dlpqZ ~]#
[root@iZj6c45wku1lv9c4w5dlpqZ ~]# blkid 查看磁盘UUID
/dev/vda1: UUID="a3b07a51-3009-4ddf-9240-81333f13880e" TYPE="ext4"
/dev/vdb1: UUID="883cb023-0e52-45d0-bc4f-a40b0247bd99" TYPE="ext4"
[root@iZj6c45wku1lv9c4w5dlpqZ ~]#
[root@iZj6c45wku1lv9c4w5dlpqZ ~]#

[root@iZm5e9eb5azhksxowz185wZ ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Fri Feb 24 02:58:22 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=07151862-c2b9-45dc-bfndfasdssddfcadd   / ext3 defaults 1 1
UUID="a3b07a51-3009-4ddf-9240-81333f13880e  /mnt ext4 defaults 0 0

[root@iZm5e9eb5azhksxowz185wZ ~]#

转载于:https://www.cnblogs.com/xy51/p/9603543.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值