linux磁盘挂载

创建磁盘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
fdisk /dev/vdb
Command (m for help): n #新建分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p # 主分区
Partition number (1-4, default 1):
First sector (2048-104857599, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599):
Using default value 104857599
Partition 1 of type Linux and of size 50 GiB is set

Command (m for help): w # 保存
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

mkfs.ext4 /dev/vdb1 # 文件系统初始化

blkid
/dev/vda1: UUID="" TYPE="ext4"
/dev/vdb1: UUID="" TYPE="ext4"
# 追加至/etc/fstab
UUID=<UUID> /home/new_disk ext4 defaults 0 2

刷新分区表