新增数据盘
Posted xy51
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了新增数据盘相关的知识,希望对你有一定的参考价值。
第一步:在阿里云创建云盘(必须和挂载的服务器是一个区域一个分区)
购买完之后在阿里云上面先挂载
第二步:创建磁盘分区
[[email protected] ~]# 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
对未分区磁盘进行分区
[[email protected] ~]# 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.
[[email protected] ~]#
[[email protected] ~]# 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格式
[[email protected] ~]# 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.
[[email protected] ~]# 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
第三步:挂载上要指定的目录(当挂载的目录下面有数据的时候把数据移出再挂载,否则挂载上目录下面会没有数据)
[[email protected] ~]# mount /dev/vdb1 /mnt 将分区挂载到/mnt下
[[email protected] ~]#
第四步:可以设置开机自动挂载
[[email protected] ~]# vi /etc/fstab 磁盘开机自动挂载
#
# /etc/fstab
# Created by anaconda on Fri Aug 25 11:52:44 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=a3b07a51-3009-4ddf-9240-81333f13880e / ext4 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[[email protected] ~]#
[[email protected] ~]# blkid 查看磁盘UUID
/dev/vda1: UUID="a3b07a51-3009-4ddf-9240-81333f13880e" TYPE="ext4"
/dev/vdb1: UUID="883cb023-0e52-45d0-bc4f-a40b0247bd99" TYPE="ext4"
[[email protected] ~]#
[[email protected] ~]#
[[email protected]wz185wZ ~]# 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 /data ext4 defaults 0 0
[[email protected] ~]#
以上是关于新增数据盘的主要内容,如果未能解决你的问题,请参考以下文章