【磁盘/文件系统】第二篇:标准磁盘分区流程针对fdisk(硬盘容量小于2T且分区数不能大于15个分区)
前奏:先插上一块磁盘(做了RAID的磁盘才能分区)
查看磁盘连上服务器没有,或者说是可以进行分区前奏
  [root@PandaLi ~]# ll /dev/sd
  sda   sda1  sda2  sda3  sdb   sdc
第一步:创建分区命令
(这里说一下为什么要使用 -c 和 -u参数)
[root@PandaLi ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel        【下面三行是第一次进行分区它会自动提示的,我们不需要管】
Building a new DOS disklabel with disk identifier 0x7711a1b3.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to    【警告:dos兼容模式被弃用】
         switch off the mode (command 'c') and change display units to            【强烈建议在分区的时候使用-c 和 -u 参数】
         sectors (command 'u').
Command (m for help):
创建分区标准命令:fdisk -cu /dev/sdb [对/dev/sdb进行分区]
[root@PandaLi ~]# fdisk -cu /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa8d09c04.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help):
fdisk命令参数介绍
  m、获取帮助
     p、打印分区表。
     n、新建一个新分区。
     d、删除一个分区。
     q、退出不保存。
     w、把分区写进分区表,保存并退出。
Command (m for help): n ####创建一个分区
Command action
e extended
p primary partition (1-4)
p ####创建一个主分区
Partition number (1-4): 1 ####设置主分区编号
First sector (2048-2097151, default 2048): ####主分区开始位置(默认是扇区)
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +200M ####主分区结束位置 (可以使用K M G 单位) Command (m for help): p ####查看当前分区信息 Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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 identifier: 0xa8d09c04 Device Boot Start End Blocks Id System
/dev/sdb1 2048 411647 204800 83 Linux Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 2
First sector (411648-2097151, default 411648):
Using default value 411648
Last sector, +sectors or +size{K,M,G} (411648-2097151, default 2097151): +300M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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 identifier: 0xa8d09c04 Device Boot Start End Blocks Id System
/dev/sdb1 2048 411647 204800 83 Linux
/dev/sdb2 411648 1026047 307200 83 Linux Command (m for help): n
Command action
e extended
p primary partition (1-4)
e ####创建一个扩展分区
Partition number (1-4): 3
First sector (1026048-2097151, default 1026048):
Using default value 1026048
Last sector, +sectors or +size{K,M,G} (1026048-2097151, default 2097151):
Using default value 2097151 Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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 identifier: 0xa8d09c04 Device Boot Start End Blocks Id System
/dev/sdb1 2048 411647 204800 83 Linux
/dev/sdb2 411648 1026047 307200 83 Linux
/dev/sdb3 1026048 2097151 535552 5 Extended Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l ####创建一个逻辑分区(必须先要有扩展分区才能有逻辑分区)
First sector (1028096-2097151, default 1028096):
Using default value 1028096
Last sector, +sectors or +size{K,M,G} (1028096-2097151, default 2097151): +100M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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 identifier: 0xa8d09c04 Device Boot Start End Blocks Id System
/dev/sdb1 2048 411647 204800 83 Linux
/dev/sdb2 411648 1026047 307200 83 Linux
/dev/sdb3 1026048 2097151 535552 5 Extended
/dev/sdb5 1028096 1232895 102400 83 Linux
Command (m for help): t      ####修改分区的ID
Partition number (1-5): 5
Hex code (type L to list codes): l  ####查看全部编号(小写L)
0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx         
 5  Extended        42  SFS             86  NTFS volume set da  Non-FS data    
 6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility   
 8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1
Hex code (type L to list codes): 82    ####把ID修改为82
Changed system type of partition 5 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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 identifier: 0xa8d09c04
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      411647      204800   83  Linux
/dev/sdb2          411648     1026047      307200   83  Linux
/dev/sdb3         1026048     2097151      535552    5  Extended
/dev/sdb5         1028096     1232895      102400   82  Linux swap / Solaris
Command (m for help): d ####删除一个分区
Partition number (1-5): 5
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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 identifier: 0xa8d09c04
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      411647      204800   83  Linux
/dev/sdb2          411648     1026047      307200   83  Linux
/dev/sdb3         1026048     2097151      535552    5  Extended
Command (m for help):
Command (m for help): w    ####保存退出(q 是不保存退出)
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@PandaLi ~]#
第二步:查看内核是否已经识别分区命令
	  cat /proc/partitions
第三步:通知内核重新读取磁盘分区表
	  方法一:
		    partprobe /dev/sdb    【推荐】
	  方法二:
		    partx [-a,-n]  /dev/DEVICE
参数:
    -a:读取全部分区表
    -n:读取指定的分区表
	  方法三:
		    kpartx  [-a,-f] /dev/DEVICE
			    参数:
    -a:读取全部分区表
    -f:强制读取分区表 【注意:这种方法不建议使用,如果上面的读取方法不行的话,最后才使用这种方法】
第四步:格式化创建文件系统
	  mkfs.ext4 /dev/sdb1
  注意:
		    格式化文件系统的时候必须要指定格式化哪个分区
		    格式化文件系统之后,系统会默认挂载25次或180天之后进行磁盘检查
第五步:让系统不对我们新创建的分区进行磁盘检查
	  tune2fs -c 0 -i 0 /dev/sdb1
注意:这里也是必须要指定哪个分区
第六步:文件系统的临时挂载
	  临时挂载:mount /dev/sdb1 /mnt/     【这里也是必须要指定哪个分区】
第七步:文件系统永久挂载
	  方法一:设置开机自动运行
		    把挂载命令放入到/etc/rc.local
	  方法二:添加到开机自动挂载配置文件
		    /etc/fstab      【设备文件  挂载点  设备文件类型  挂载参数  是否进行备份  是否进行磁盘检查】  
		    如果想以UUID挂载的话,可以使用命令查看分区的UUID编号:命令(blkid)
第八步:查看挂载情况
	  mount
	  cat /proc/mounts
备注:更多信息请查看本地资料:磁盘章节内容
【磁盘/文件系统】第二篇:标准磁盘分区流程针对fdisk(硬盘容量小于2T且分区数不能大于15个分区)的更多相关文章
- 【磁盘/文件系统】第三篇:标准磁盘分区流程针对parted(一般硬盘容量大于2T(但是小于2T也可以进行分区);分区数最大是支持100多个分区)
		说明: 在 Linux 上可以采用 parted 来对磁盘进行分区 1.通过 fdisk -l 可以查看磁盘是否存在, 由于使用的是大磁盘(大于2T),fdisk 不能用来作为分区工具了,而应该使用 ... 
- CentOS7搭建FastDFS V5.11分布式文件系统-第二篇
		1.CentOS7 FastDFS搭建 前面已下载好了要用到的工具集,下面就可以开始安装了: 如果安装过程中出现问题,可以下载我提供的,当前测试可以通过的工具包: 点这里点这里 1.1 安装libfa ... 
- 第二篇:git创建流程
		1.创建组织 2.创建 3.点击项目 创建完: 4.选择管理——>选择公钥——>添加个人公钥: 5.怎样生成公钥 5.1.如何生成ssh公钥 你可以按如下命令来生成 sshkey: ssh ... 
- (转)硬盘分区备忘(主分区,扩展分区和逻辑分区)以及Linux硬盘分区工具parted 介绍
		场景:最近在学习Linux的基础知识,不可避免的设计到Linux的磁盘分区,以前做过总结,但是那种总结就是复制别人的文章,总结完就不想看第二遍,所以很容易就遗忘了!清楚明白的理解分区后,我就可以在自己 ... 
- Linux性能优化从入门到实战:15 文件系统篇:磁盘 I/O
		磁盘 磁盘是可以持久化存储的设备,按照存储介质来分类: (1)机械磁盘(硬盘驱动器,Hard Disk Driver,HDD),主要由盘片和读写磁头组成,数据就存储在盘片的环状磁道中.在读写数 ... 
- Linux文件系统简介一(磁盘分区、开机过程、目录结构、文件权限、文件扩展名、目录管理)
		Linux:就是一组软件,一套操作系统=核心+系统呼叫接口层. 1.操作系统 操作系统 = 核心(内核) + 系统呼叫(接口) 操作系统其实也是一组程序,重点在于管理计算机的所有活动以及驱动系统中的所 ... 
- SQL Server 服务器磁盘测试之SQLIO篇
		原文:SQL Server 服务器磁盘测试之SQLIO篇 数据库调优工作中,有一部分是需要排查IO问题的,例如IO的速度或者RAID级别无法响应高并发下的快速请求.最常见的就是查看磁盘每次读写的响应速 ... 
- SQL Server 服务器磁盘测试之SQLIO篇(一)
		数据库调优工作中,有一部分是需要排查IO问题的,例如IO的速度或者RAID级别无法响应高并发下的快速请求.最常见的就是查看磁盘每次读写的响应速度,通过性能计数器Avg.Disk sec/Read(Wr ... 
- 磁盘文件系统Fat、Fat32、NTFS、exFAT的优缺点
		我们在Windows系统里格式化磁盘的时候,文件系统的选项里可以看到有“FAT”.“FAT32”.“NTFS”等选项,在对U盘或其他移动存储设备 格式化的时候还会出现“exFAT”选项,那么这四种磁盘 ... 
随机推荐
- iOS中如何使定时器NSTimer不受UIScrollView滑动所影响
			以下是使用 scheduledTimerWithTimeInterval 方法来实现定时器 - (void)addTimer { NSTimer scheduledTimerWithTimeInter ... 
- 【数据结构模版】可持久化线段树 && 主席树
			浙江集训Day4,从早8:00懵B到晚21:00,只搞懂了可持久化线段树以及主席树的板子.今天只能记个大概,以后详细完善讲解. 可持久化线段树指的是一种基于线段树的可回溯历史状态的数据结构.我们想要保 ... 
- zuul1.x和gateway的区别
			阻塞与非阻塞: 1.实际上是Spring mvc与Spring webflux的区别 转载:https://www.cnblogs.com/lixinjie/p/a-brother-of-spring ... 
- 冲刺随笔——Day_Seven
			这个作业属于哪个课程 软件工程 (福州大学至诚学院 - 计算机工程系) 这个作业要求在哪里 团队作业第五次--Alpha冲刺 这个作业的目标 团队进行Alpha冲刺 作业正文 正文 其他参考文献 无 ... 
- sql中count(1)、count(*)与count(列名)的区别
			1. count(1) and count(*) 当表的数据量大些时,对表作分析之后,使用count(1)还要比使用count(*)用时多了!从执行计划来看,count(1)和count(*)的效果是 ... 
- 学习abp vnext框架到精简到我的Vop框架
			学习目标 框架特点 基于.NET 5平台开发 模块化系统 极少依赖 极易扩展 ....... 框架目的 学习.NET 5平台 学习abp vnext 上图大部分功能已经实现,多数是参考(copy)ab ... 
- PyQt(Python+Qt)学习随笔:QListWidget插入多项的insertItems方法
			老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 除了insertItem方法能插入项外,QListWidget支持一次插入多个项,对应的方法就是in ... 
- Azure Cosmos DB (五)  .Net Core 控制台应用
			一,引言 之前在讲Azure CosmosDB Core(SQL)核心的时候,使用了EF Core 的方式,引用了 "Microsoft.EntityFrameworkCore.Cosmos ... 
- flask中的return、过滤器详解
			之前吧一直学习flask的时候,一直不明白response是怎么产生,今天是明白了.retrun 哎呀,这个地方看着挺小心的东西, 蕴含的能量可不小啊.今天我详细总结总结. 先来写jinjia2语法 ... 
- 深入理解Java虚拟机(一)——JVM内存模型
			文章目录 程序计数器 定义 作用 特点 Java虚拟机栈 定义 特点 本地方法栈 定义 Java堆 定义 特点 方法区 定义 特点 运行常量池 直接内存 总结 Java虚拟机的内存空间分为五个部分: ... 
