站点图标 IDC铺

CentOS系统下数据盘挂载方法

具体步骤如下:

1、首先查看磁盘及分区信息

#fdisk -l (查看数据盘是否有分区,如果没有分区需要进行分区)

2、发现磁盘 /dev/vdb,然后使用命令进行分区

# fdisk /dev/vdb

fdisk命令如下:

命令(输入 m 获取帮助):m

命令操作

  a  toggle a bootable flag

  b  edit bsd disklabel

  c  toggle the dos compatibility flag

  d  delete a partition

  g  create a new empty GPT partition table

  G  create an IRIX (SGI) partition table

  l  list known partition types

  m  print this menu

  n  add a new partition

  o  create a new empty DOS partition table

  p  print the partition table

  q  quit without saving changes

  s  create a new empty Sun disklabel

  t  change a partition’s system id

  u  change display/entry units

  v  verify the partition table

  w  write table to disk and exit

  x  extra functionality (experts only)

3、然后新建分区

命令(输入 m 获取帮助):n

Partition type:

  p  primary (0 primary, 0 extended, 4 free)

  e  extended

Select (default p): 

Using default response p

分区号 (1-4,默认 1):

起始 扇区 (2048-3221225471,默认为 2048):

将使用默认值 2048

Last 扇区, +扇区 or +size{K,M,G} (2048-3221225471,默认为 3221225471):

将使用默认值 3221225471

分区 1 已设置为 Linux 类型,大小设为 1.5 TiB

4、最后保存分区

命令(输入 m 获取帮助):w

The partition table has been altered!

Calling ioctl() to re-read partition table.

正在同步磁盘。

5、建好分区后要格式化分区,建立文件系统

# mkfs.xfs -f /dev/vdb1 (这里创建的是xfs系统,也可以输入命令:#mkfs.ext4 /dev/vdb1 创建ext4文件系统)

6、这样文件系统就建好了,然后选择一个挂载点挂上就可以了,我挂载在/www 下了

# mount /dev/vdb1 /www

7、将挂载信息写入文件/etc/fstab,让系统启动后自动挂载,否则重启会掉

#echo ‘/dev/vdb1 /www xfs defaults 0 0’ >> /etc/fstab (如果是ext4格式请将xfs替换掉))

注:如果已有分区文件系统,可略过2-5步,直接进行挂载

退出移动版