侧边栏壁纸
博主头像
cn2linux博主等级

行动起来,活在当下

  • 累计撰写 127 篇文章
  • 累计创建 1 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

CentOS 8 挂载新硬盘

## 1. 以root身份登录系统

## 2. 列出磁盘分区
[root@localhost /]# fdisk -l

## 3. 找到还没有分区的磁盘(磁盘下没有Device的即为未分区磁盘),创建分区并格式化
[root@localhost ~]# fdisk /dev/vdb

## 4. 选择n, 创建新的分区 
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)

## 5.选择p,创建主分区(每个磁盘最多只有4个主分区)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-524287999, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-524287999, default 524287999): 
Created a new partition 1 of type 'Linux' and of size 250 GiB.

## 6. 输入w 分区信息写入磁盘
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

## 7. 再次fdisk -l, 找到分区为/dev/bdb1,
[root@localhost ~]# fdisk -l
Disk /dev/vda: 250 GiB, 268435456000 bytes, 524288000 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

Disklabel type: dos
Disk identifier: 0x7693b92c
Device     Boot   Start       End   Sectors  Size Id Type
/dev/vda1  *       2048   2099199   2097152    1G 83 Linux
/dev/vda2       2099200 524287999 522188800  249G 8e Linux LVM
Disk /dev/vdb: 250 GiB, 268435456000 bytes, 524288000 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

Disklabel type: dos
Disk identifier: 0xd69a2e82
Device     Boot Start       End   Sectors  Size Id Type
/dev/vdb1        2048 524287999 524285952  250G 83 Linux

## 8. 使用xfs 格式化
[root@localhost ~]# mkfs.xfs -f /dev/vdb1

## 9. 挂载到文件系统
[root@localhost /]# mount /dev/vdb1 /data

## 10. //系统重启自动挂载该分区对fstab进行编辑
[root@kiccleaf ~]# vim /etc/fstab

系统重启自动挂载该分区可修改/etc/fstab文件,在最后加入添加:/dev/vdb1 /data xfs defaults 0 0

参考网址

[CentOS 8 挂载新硬盘](http://8.129.108.223/post/linux-basic/CentOS8-mount-new-disk/)

0
  • ${post.likes!0}

评论区