Fdisk: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(10 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[Linux#Commands|Linux]]
* [[Linux#Commands|Linux]]
* [[Linux 7 Storage Concepts#Commands|Storage - Commands]]
* [[sfdisk]]
* [[sfdisk]]
* [[parted]]


=Overview=
=Overview=


Manipulates the partition table.
Manipulates the partition table.
=Limitations=
<tt>fdisk</tt> does not seem to be able to created partition larger than 2 TB. The procedure described [[#Create_a_Partition_that_Spans_the_Entire_Device|below]] produces a 2 TB partition on a 4TB physical disk. To create larger partitions, use [[parted]].
{{Internal|parted|parted}}


=Create a Partition that Spans the Entire Device=
=Create a Partition that Spans the Entire Device=
Line 38: Line 45:
Syncing disks.
Syncing disks.
</pre>
</pre>
Result:
<pre>
Disk /dev/sdb: 536 MB, 536870912 bytes, 1048576 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: 0x4c72790e
  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1            2048    1048575      523264  8e  Linux LVM
</pre>
=Options=
==-l==

Latest revision as of 05:37, 15 December 2018

Internal

Overview

Manipulates the partition table.

Limitations

fdisk does not seem to be able to created partition larger than 2 TB. The procedure described below produces a 2 TB partition on a 4TB physical disk. To create larger partitions, use parted.

parted

Create a Partition that Spans the Entire Device

fdisk /dev/sdb
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-1048575, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1048575, default 1048575):
Using default value 1048575
Partition 1 of type Linux and of size 511 MiB is set

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

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

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

Result:

Disk /dev/sdb: 536 MB, 536870912 bytes, 1048576 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: 0x4c72790e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1048575      523264   8e  Linux LVM

Options

-l