阿里云挂载100G的数据盘

 

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

 

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0008d73a

 

   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *        2048    83884031    41940992   83  Linux

 

Disk /dev/vdb: 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

 

2.[root@web01 ~]# fdisk /dev/vdb  对未分区的磁盘进行分区

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xf0338c3b.

 

Command (m for help): n     m查看帮助  n 新增加分区

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

Partition number (1-4, default 1): 1  分区编号

First sector (2048-209715199, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):

Using default value 209715199

Partition 1 of type Linux and of size 100 GiB is set

 

Command (m for help): wq  写入保存

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@web01 ~]# fdisk -l  查看新建分区

 

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0008d73a

 

   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *        2048    83884031    41940992   83  Linux

 

Disk /dev/vdb: 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: 0xf0338c3b

 

   Device Boot      Start         End      Blocks   Id  System

/dev/vdb1            2048   209715199   104856576   83  Linux

3.[root@web01 ~]# mkfs -t ext4 /dev/vdb1 将新建分区格式化为ext4格式

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

6553600 inodes, 26214144 blocks

1310707 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2174746624

800 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

 

Allocating group tables: done                            

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done   

 

[root@web01 ~]# fdisk -l  查看分区列表

 

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0008d73a

 

   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *        2048    83884031    41940992   83  Linux

 

Disk /dev/vdb: 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: 0xf0338c3b

 

   Device Boot      Start         End      Blocks   Id  System

/dev/vdb1            2048   209715199   104856576   83  Linux

4.[root@web01 /]# mount /dev/vdb1 /mnt  挂载到指定的目录

[root@web01 /]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/vda1        40G  1.6G   36G   5% /

devtmpfs        3.9G     0  3.9G   0% /dev

tmpfs           3.9G     0  3.9G   0% /dev/shm

tmpfs           3.9G  316K  3.9G   1% /run

tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup

tmpfs           783M     0  783M   0% /run/user/0

/dev/vdb1        99G   61M   94G   1% /mnt

[root@web01 /]# blkid

/dev/vda1: UUID="eb448abb-3012-4d8d-bcde-94434d586a31" TYPE="ext4"

/dev/vdb1: UUID="59cd2a13-8ed1-4653-8569-7e714b8247dd" TYPE="ext4"

[root@web01 /]# vi  /etc/fstab 设置开机自动挂载

 

#

# /etc/fstab

# Created by anaconda on Sun Oct 15 15:19:00 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=eb448abb-3012-4d8d-bcde-94434d586a31 /                       ext4    defaults        1 1

UUID=59cd2a13-8ed1-4653-8569-7e714b8247dd /mnt                    ext4    defaults        0 0