Change extended partition id
Environment
- Red Hat Enterprise Linux (RHEL)
Issue
- We are currently seeing the following (below) when doing an fdisk -l on one of our servers. We see a partition that has a label f which is W95 Ext'd (LBA). We noticed that this partition /dev/sda4 seems to have the same start as /dev/sda5 and the same end as /dev/sda7 which are both Linux LVM partitions. After doing df, pvs, fdisk -l, blkid, etc we don't see where the /dev/sda4 partition is being used so we are wondering if this can be removed or relabeled?? Currently this is causing issues with our backups since this label is not supported.
Disk /dev/sda: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1798 14338012+ 83 Linux
/dev/sda3 1799 2320 4192965 82 Linux swap / Solaris
/dev/sda4 2321 7148 38780910 f W95 Ext'd (LBA)
/dev/sda5 2321 3748 11470378+ 8e Linux LVM
/dev/sda6 3749 5189 11574801 8e Linux LVM
/dev/sda7 5190 7148 15735636 8e Linux LVM
Resolution
Unfortunately there is no way to achieve same without re-creating partitions.
What you can do is, attach new disk and copy all data from these partitions to that new disk. After this, delete this extended partition and re-create it with same starting and end cylinder.
Root Cause
/dev/sda4
is extended partition and other partitions (sda5-sda7)
are logical partitions.
I tried to change extended partition type but its not allowed :
# fdisk /dev/loop0
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/loop0: 209 MB, 209715200 bytes, 409600 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: 0x3f8862cf
Device Boot Start End Blocks Id System
/dev/loop0p1 2048 22527 10240 83 Linux
/dev/loop0p2 22528 409599 193536 5 Extended
Command (m for help): t
Partition number (1,2, default 2):
Hex code (type L to list all codes): f
You cannot change a partition into an extended one or vice versa.
Delete it first.
Type of partition 2 is unchanged: Extended
Command (m for help):
If you want to change extended partition id from "W95 Ext'd (LBA)" then its not possible. Only way is to re-create it.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments