When using fdisk, how do I find what partition numbers are already in use?
The partition number do you talking about is the number of a primary partition. You can have only four per device and you can't use the same partition number twice.
To list the partition number use, e.g
sudo fdisk /dev/sda
or (for an example see below))
sudo parted /dev/sda print
You should see something like this
% sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.26.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/sdb: 7,5 GiB, 8019509248 bytes, 15663104 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
Disklabel type: dos
Disk identifier: 0xc3072e18
Device Boot Start End Sectors Size Id Type
/dev/sdb1 62 15650907 15650846 7,5G 83 Linux
This means, I have one primary partition. The next primary partition would be 2, 3, 4. This
/dev/sdb1
and this
/dev/sdb5
means, you have one primary partition sda1
and one logical partition sdb5
. You can only create logical partitions inside a primary partition.
To show the partition types you could use
sudo parted /dev/sda print
Output could be
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 105GB 105GB primary ntfs boot
2 105GB 205GB 100GB primary ext3
3 205GB 207GB 1999MB primary linux-swap
4 207GB 500GB 293GB extended lba
5 207GB 500GB 293GB logical ntfs
Means sda4
is a primary partition now called extended partition, with one logical partition.
The partition number isn't the same number as the ID. The ID is the ID for the type of the partition:
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L ff BBT
1e Hidden W95 FAT1 80 Old Minix be Solaris boot
Related videos on Youtube
Catbird55
Updated on September 18, 2022Comments
-
Catbird55 over 1 year
When I create a new partition with fdisk, I am asked to choose a number for the new partition (1 through 4). Is this number the same as the integer value for "ID" when I use
fdisk -l
? If so, why are some greater than 4? If not, what command do I use to view the partiion numbers that are available to me? What is the consequence of just choosing 1 for two or more partitions? I know that this can work (at least, it seems to work without problems). -
Terrance over 8 yearsI was going to post a comment about being allowed only 4 primary partitions in the dos partition scheme, but you beat me to it. =) +1