首页 > 其他 > 详细

centos磁盘分区挂载

时间:2021-04-12 12:28:43      阅读:29      评论:0      收藏:0      [点我收藏+]
# 查看磁盘
fdisk -l
# 分区
[root@ecshost ~]# fdisk -u /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write commad.

Command (m for help): p

Disk /dev/vdb: 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: dos
Disk identifier: 0x2b31a2a3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048    41943039    20970496   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (41943040-83886079, default 41943040):
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-83886079, default 83886079):
Using default value 83886079
Partition 2 of type Linux and of size 20 GiB is set

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

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

# 格式化
创建ext4文件系统:
mkfs.ext4 /dev/vdb1
# 查看格式化信息
blkid /dev/vdb1
# 挂载
建立挂载目录

# mkdir /data

挂载分区

# mount /dev/vdb1 /data

 设置开机自动挂载

vi /etc/fstab

在vi中输入i进入INERT模式,将光标移至文件结尾处并回车,将下面的内容复制/粘贴,然后按Esc键,输入:x保存并退出

/dev/vdb1              /data                   ext4    defaults        0 0

 确认是否挂载成功

重启服务器

# reboot

查看硬盘分区

# df

/dev/vdb1            20635700    176196  19411268   1% /data

 

centos磁盘分区挂载

原文:https://www.cnblogs.com/jasonzeng/p/14647173.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!