linux 云服务器挂载云盘

2021-07-23 18:05:35 浏览数 (2)

查看硬盘

代码语言:javascript复制
fdisk -l
代码语言:javascript复制
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
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: gpt
Disk identifier: FA5D4CB9-C419-4DBE-AFBE-BFC942811628

# Start End Size Type Name
1 2048 2099199 1G EFI System EFI System Partition
2 2099200 83884031 39G Microsoft basic
代码语言:javascript复制
Disk /dev/vdb: 1073.7 GB, 1073741824000 bytes, 2097152000 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
执行命令:fdisk /dev/vdb
依次按 "n"、"p"、"3次回车"、"wq"即可
代码语言:javascript复制
格式化云盘
mkfs.ext4 /dev/vdb1
新建文件夹并挂载
mkdir /data
mount /dev/vdb1 /data
df -h
代码语言:javascript复制
配置开机挂载
查看UUID
# blkid /dev/vdb1
/dev/vdb1: UUID="fadf579f-fe04-4e58-8811-07dd778aa8a1" TYPE="ext4"

修改配置文件 vim /etc/fstab UUID=fadf579f-fe04-4e58-8811-07dd778aa8a1 /data ext4 defaults 0 0

0 人点赞