首页 > f-fdisk做磁盘分区,起始扇区从2048块开始

f-fdisk做磁盘分区,起始扇区从2048块开始

文章目录

        • First Sector 起始扇区
        • fdisk工具加分区
        • fdisk删除分区

First Sector 起始扇区

默认从第2048块扇区开始是因为,由于EFI的兴起,要给EFI 代码留磁盘最开始的1M空间,即2048*521/(1024*1024)=1M

With the death of the legacy BIOS (ok, its not quite dead yet) and its replacement with EFI BIOS, a special boot partitionis needed to allow EFI systems to boot in EFI mode.

Starting the first partition at sector 2048 leaves 1Mb for the EFI boot code. Modern partitioning tools do this anyway and fdisk has been updated to follow suit.

随着传统BIOS的死亡(不确定,它还没有完全死亡)并且用EFI BIOS替代它,需要一个特殊的启动分区来允许EFI系统以EFI模式启动。

在扇区2048处启动第一个分区会留下1Mb用于EFI引导代码。 现代分区工具无论如何都会这样做,并且fdisk已经更新

EFI是Extensible Firmware Interface(可扩展固件接口)的缩写

fdisk工具加分区

fdisk /dev/sdb 进入如下命令


WARNING: The size of this disk is 4.0 TB (4000787030016 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID 
partition table format (GPT).The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
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 command.Command (m for help): 

输入help,可以看到很多帮助指令

   a   toggle a bootable flagb   edit bsd disklabelc   toggle the dos compatibility flagd   delete a partitiong   create a new empty GPT partition tableG   create an IRIX (SGI) partition tablel   list known partition typesm   print this menun   add a new partitiono   create a new empty DOS partition tablep   print the partition tableq   quit without saving changess   create a new empty Sun disklabelt   change a partition's system idu   change display/entry unitsv   verify the partition tablew   write table to disk and exitx   extra functionality (experts only)

输入n,新添加一个分区

 p   primary (1 primary, 0 extended, 3 free)e   extended

一般选择p主分区,默认一块hdd可以做4分区,如果想要添加扩展分区,就选择e

Partition number (1-4, default 1): 1 #默认从第一分区开始
First sector (2048-4294967295, default 2048): 直接回车  #第一个起始扇区,每个扇区大小默认为512B,默认从2048开始,详细原因已经在上面描述,需要为EFI留下启动空间
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): 429496 #自己选择的结束分区大小,可以手动计算分区 (429496 *512)/(1024*1024*1024) M
Partition 1 of type Linux and of size 208.7 MiB is set

接下来可以使用p来查看做出的分区

Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048      429496      213724+  83  Linux

如果确定添加好之后可以选择w,保存配置。否则继续按照如上步骤添加

The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks.

fdisk删除分区

同样使用fdisk /dev/sdb进入想要操作得磁盘界面


WARNING: The size of this disk is 4.0 TB (4000787030016 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID 
partition table format (GPT).The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
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 command.Command (m for help): 

输入p打印当前分区情况


Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048      429496      213724+  83  Linux
/dev/sdd2          430080    42949672    21259796+  83  Linux

输入d开始删除分区

Command (m for help): d #当前分区号是可选的,可以选择1或者2
Partition number (1,2, default 2): 1
Partition 1 is deleted

输入p查看分区内容

Command (m for help): p
Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000Device Boot      Start         End      Blocks   Id  System
/dev/sdd2          430080    42949672    21259796+  83  Linux

想要接着删除,那么继续输入d,否则输入w保存退出

更多相关:

  • 因SYS表空间建立的时候巨小,如下:NAME                                 SPACE_bytes    MAX_bytes USED_bytes UNUSED_bytes FREE_bytes             STATUS-------------------- ----------- -...

  • 1. Build uboot a) 安装好toolchain (arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz)并设置好 环境变量PATH,保证可以正常使用。 b) 解压 uboot_tiny4412-20130729.tgz 并进入相应的目录 tar xzf uboot_tiny4412-201307...

  • 分区助手 - 很棒的磁盘分区调整软件 http://www.onlinedown.net/soft/111710.htm 转载于:https://www.cnblogs.com/olmlo/archive/2013/06/05/3119411.html...