美文网首页
Linux磁盘分区-centos7

Linux磁盘分区-centos7

作者: 传奇FA | 来源:发表于2019-04-25 21:12 被阅读0次

1. 磁盘查看的一些命令:

lsblk
lsblk  -o name,uuid,fstype,mountpoint
df -hT
fdisk -l

2. 分区挂载步骤:

2.1. 分区(后面具体讲)

fdisk /dev/vdb

2.2. 对分区进行格式化

xfs格式化:

mkfs.xfs -f -n ftype=1 /dev/vdb3

ext4格式化:

mkfs.ext4 /dev/vdb1

2.3. 挂载

mount /dev/vdb1 /mnt/disk1

mount /dev/vdb3 /var/lib/docker

2.4. 编辑/etc/fstab,加入下面内容

vi /etc/fstab

/dev/vdb1 /mnt/disk1 ext4 defaults 0 0

/dev/vdb3 /var/lib/docker xfs defaults,uquota,pquota 0 0

在/etc/fstab中第一列的“/dev/vdb3”等同于"UUID=<uuid>"

2.5. 重新挂载 /etc/fstab 里面的内容

mount -a

\color{red}{编辑/etc/fstab后先用mount -a 看看有没有报错,目标磁盘有没有挂载,正常后才可重启系统}

3. 对vdb磁盘进行分区

[root@test4 ~]# fdisk /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 2597.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1 ) software that runs at boot time (e.g., old versions of LILO)
2 ) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m  //输出帮助信息
  Command action
  a toggle a bootable flag  //设置启动分区
  b edit bsd disklabel  //编辑分区标签
  c toggle the dos compatibility flag
  d delete a partition  //删除一个分区
  l list known partition types  //列出分区类型
  m print this menu  //输出帮助信息
  n add a new partition  //建立一个新的分区
  o create a new empty DOS partition table  //创建一个新的空白DOS分区表
  p print the partition table  //打印分区表
  q quit without saving changes  //退出不保存设置
  s create a new empty Sun disklabel
  t change a partition's system id  //改变分区的ID
  u change display/entry units  //改变显示的单位
  v verify the partition table  //检查验证分区表
  w write table to disk and exit  //保存分区表
  x extra functionality (experts only)
Command (m for help):n
Command action
  e extended  //e是扩展分区
  p primary partition (1-4)  //p是主分区
p
Partition number (1-4): 1  //定义分区号 --主分区最多只能有四个
First cylinder (1-2597, default 1): 1  //分区开始柱面
Last cylinder or +size or +sizeM or +sizeK (1-2597, default 2597): +100G  //分区结束柱面,或者分区大小

Command (m for help): w  //保存刚才的配置信息。
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: 无效的参数.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

相关文章

  • 新增linux磁盘

    新增linux磁盘-centos7 *查看磁盘状态,查询驱动器编号fdisk-l*对磁盘分区fdisk[驱动器编号...

  • Linux磁盘分区-centos7

    1. 磁盘查看的一些命令: 2. 分区挂载步骤: 2.1. 分区(后面具体讲) 2.2. 对分区进行格式化 xfs...

  • 磁盘分区

    磁盘分区:linux磁盘分区主要分为三种:主磁盘分区、扩展磁盘分区、逻辑分区主分区:至少一个、最多4个,且主分区+...

  • 复习重点

    重点 主机规划与磁盘分区 各硬件装置在Linux中的文件名 p66 磁盘分区:课本例题 p67 磁盘分区表例...

  • Linux监控磁盘分区及使用情况的常用命令!

    Linux中监控磁盘分区及使用情况的命令有哪些?在Linux操作系统中,可用于监控磁盘分区及使用情况的命令有很多,...

  • linux入门常用指令

    ### linux磁盘分区 ![](./resources/a.jpg) #### boot分区 引导分区,存放引...

  • linux 挂载磁盘与分区lvm逻辑卷

    linux磁盘分区与挂载 1.1查看分区挂载情况,命令: 1.2创建新的磁盘分区 1.3保存分区表 1.4查看创建...

  • Linux常用命令之 - fdisk

    fdisk - Partition table manipulator for Linux 中文的意思是磁盘分区表...

  • linux文件系统

    Genaral windows使用磁盘分区等来进行管理,Linux下有文件管理标准FHS来进行规范。linux文件...

  • Linux基础知识有哪些

    Linux基础知识有哪些 一、Linux的磁盘分区及目录 Linux的配置是通过修改配置文件来完成。 1.1、Li...

网友评论

      本文标题:Linux磁盘分区-centos7

      本文链接:https://www.haomeiwen.com/subject/fletnqtx.html