阿里云挂载数据盘

查看有没有数据盘

sudo fdisk -l

Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 sectors

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 83884031 83881984  40G 83 Linux


Disk /dev/vdb: 200 GiB, 214748364800 bytes, 419430400 sectors

/dev/vdb 200 GiB 恩, 有个200GB的硬盘

分区

运行 sudo fdisk /dev/vdb
Command (m for help): 提示后, 键入 n, 以后的步骤直接 Enter确认.

sudo fdisk /dev/vdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-419430399, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-419430399, default 419430399):

Created a new partition 1 of type 'Linux' and of size 200 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

格式化

mkfs.ext4 /dev/vdb1 是格式化为ext4, 如果要格式化成ext3,
执行 mkfs.ext3 /dev/vdb1

mkfs.ext4 /dev/vdb1
mke2fs 1.42.13 (17-May-2015)
Found a dos partition table in /dev/vdb1
Proceed anyway? (y,n) y
Creating filesystem with 52428544 4k blocks and 13107200 inodes
Filesystem UUID: 8a6c75c7-3bea-4d6c-8bcf-8a638db536e0
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

分区信息写入 fstab

下次开机启动时可以自动挂载, 不然每次开机都要手动挂载

echo /dev/vdb1 /mnt ext4 defaults 0 0 >> /etc/fstab

挂载

mount /dev/vdb1 /mnt/vol

查看硬盘情况

 df -h

参考:
https://help.aliyun.com/document_detail/25426.html
https://help.aliyun.com/knowledge_detail/42526.html

你可能感兴趣的:(阿里云挂载数据盘)