OpenEuler欧拉系统新增大于2T硬盘,分区并挂载
摘要:OpenEuler系统挂载大于2T硬盘操作指南 使用fdisk -l确认新硬盘设备路径(如/dev/vdd) 采用GPT分区方案: 执行parted /dev/vdd 创建GPT标签:mklabel gpt 分区:mkpart primary ext4 2048s 100% 格式化分区:mkfs.ext4 /dev/vdd1 开机自动挂载: 获取UUID:blkid /dev/vdd1 修改
·
OpenEuler系统新增大于2T硬盘,分区并挂载
一. 查看硬盘信息
由于新添加硬盘时要确定是对哪个盘进行分区挂载,以免误操作而造成数据损失。
使用 fdisk -l 进行查看。
Disk /dev/vdd: 10 TiB, 10995116277760 bytes, 21474836480 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
从图中可以看出即将进行分区挂载的新硬盘大约是7.3T的可用空间,磁盘位置为/dev/sdb
由于磁盘的空间大于2T,所以不能用直接使用fdisk的方法进行分区,在这里我们使用GPT分区。
二. 建立磁盘标签
选择要分区的硬盘:parted /dev/vdd
[root@OpenEuler2203 dataserver2]# parted /dev/vdd
GNU Parted 3.5
Using /dev/vdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/vdd: unrecognised disk label
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 11.0TB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
create the GPT disklabel – in other words, create the partitioning tables to support GPT:
建立GPT的磁盘标签,换句话说就是创建磁盘分区表支持GPT
使用(parted) mklabel gpt
[root@OpenEuler2203 dataserver2]# parted /dev/vdd
GNU Parted 3.5
Using /dev/vdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/vdd: unrecognised disk label
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 11.0TB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
(parted) mklabel gpt
(parted) mkpart primary ext4
Start?
Start? 0
End? 100%
Warning: The resulting partition is not properly aligned for best performance: 34s % 2048s != 0s
Ignore/Cancel? cancel
(parted) exit
align-check TYPE N check partition N for TYPE(min|opt) alignment
help [COMMAND] print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkpart PART-TYPE [FS-TYPE] START END make a partition
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all] display the partition table, or available devices, or free space, or all found partitions
quit exit program
rescue START END rescue a lost partition near START and END
resizepart NUMBER END resize partition NUMBER
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
disk_set FLAG STATE change the FLAG on selected device
disk_toggle [FLAG] toggle the state of FLAG on selected device
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER
unit UNIT set the default unit to UNIT
version display the version number and copyright information of GNU Parted
(parted) quit
Information: You may need to update /etc/fstab.
[root@OpenEuler2203 dataserver2]#
[root@OpenEuler2203 dataserver2]# parted /dev/vdd
GNU Parted 3.5
Using /dev/vdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/vdd will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart primary ext4
Start? 2048s
End? 100%
(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 11.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 11.0TB 11.0TB ext4 primary
(parted) quit
Information: You may need to update /etc/fstab.
[root@OpenEuler2203 dataserver2]# mkfs.ext4 /dev/vdd1
mke2fs 1.46.4 (18-Aug-2021)
Discarding device blocks: done
Creating filesystem with 2684354048 4k blocks and 335544320 inodes
Filesystem UUID: 62aa557e-b5de-4723-9093-a361723b6f49
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
添加开机自动挂载
确定文件系统类型
这里的 TYPE 字段就是文件系统类型,例如 ext4。
[root@OpenEuler2203 202412]# sudo blkid /dev/vdd1
/dev/vdd1: UUID="62aa557e-b5de-4723-9093-a361723b6f49" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="primary" PARTUUID="31ee174c-b47d-445a-b57d-0c0a000a9ebb"
编辑 /etc/fstab 文件
使用文本编辑器(如 vi 或 nano)打开 /etc/fstab 文件:
sudo vi /etc/fstab
# 在末尾添加:
UUID=62aa557e-b5de-4723-9093-a361723b6f49 /www/wwwroot/cloud_ceamg_com/data/dataserver2/emby-data2/ ext4 defaults 0 0
- 参数解释:
- 第一列:设备名,这里是
/dev/vdd1。 - 第二列:挂载点,即
/www/wwwroot/cloud_ceamg_com/data/dataserver2/emby-data2/。 - 第三列:文件系统类型,根据
blkid命令的输出填写,如ext4。 - 第四列:挂载选项,
defaults表示使用默认选项。 - 第五列:是否使用
dump备份,0表示不备份。 - 第六列:是否在开机时使用
fsck检查磁盘,0表示不检查。
- 第一列:设备名,这里是
检查配置正确性:
sudo mount -a
验证挂载结果:
df -h | grep /dev/vdd1
鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。
更多推荐



所有评论(0)