Hard drive issue

Robert Nichols rnicholsNOSPAM at comcast.net
Sat Sep 5 00:47:14 UTC 2015


On 09/04/2015 05:05 PM, Patrick Dupre wrote:
> Thank Bob, it works
>
> Then, It can reproduce the issue
> under fdisk, I delete 2 partitions (6 and 7) and create 2 new ones
> (with different size).
> Then I get:
> /dev/sdd1            4096  26617855  26613760  12.7G  7 HPFS/NTFS/exFAT
> /dev/sdd2        26619705  38909429  12289725   5.9G  7 HPFS/NTFS/exFAT
> /dev/sdd3        38909430  49142834  10233405   4.9G  7 HPFS/NTFS/exFAT
> /dev/sdd4        49142835 976768064 927625230 442.3G  5 Extended
> /dev/sdd5        49142898  98301734  49158837  23.5G 82 Linux swap / Solaris
> /dev/sdd6       190466703 251915264  61448562  29.3G 83 Linux
> /dev/sdd7       251915328 309267314  57351987  27.4G 83 Linux
> /dev/sdd8       309270528 461461503 152190976  72.6G 83 Linux
> /dev/sdd9        98304000  99327999   1024000   500M 83 Linux
> /dev/sdd10       99330048 190466639  91136592  43.5G 83 Linux
>
> Partition table entries are not in disk order.
>
> Command (m for help): w
> The partition table has been altered.
> Calling ioctl() to re-read partition table.
> Re-reading the partition table failed.: Device or resource busy
>
> The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
>
>
>
> Then, if I want to fix the partition order with fdisk expert f
> it mess up every thing again!
>
> What do I need to run?

Within the extended partition, whenever you delete any of the logical
partitions the numbering for all of the higher-numbered ones shifts
down. If you are using fdisk, you would need to delete partitions
6 through 10, then re-create them, being very careful that partitions
8, 9, and 10 are in exactly the same positions as before.

The easiest thing to do is to use sfdisk again, and just change the
entries for partitions 6 and 7:

###################################
unit: sectors

/dev/sde1 : start=     4096, size= 26613760, Id= 7
/dev/sde2 : start= 26619705, size= 12289725, Id= 7
/dev/sde3 : start= 38909430, size= 10233405, Id= 7
/dev/sde4 : start= 49142835, size=927625230, Id= 5
/dev/sde5 : start= 49142898, size= 49158837, Id=82
/dev/sde6 : start= 98304000, size=  1024000, Id=83, bootable
/dev/sde7 : start= 99330048, size= 91136592, Id=83
/dev/sde8 : start=190466703, size= 61448562, Id=83
/dev/sde9 : start=251915328, size= 57351987, Id=83
/dev/sde10: start=309270528, size=152190976, Id=83
###################################

Because fdisk was forcing 1MB alignment for the new partitions, it
left a little extra space between partitions 5 and 6, and again
between partitions 6 and 7. If you want to reclaim that space
(your other partitions aren't aligned anyway), you could gain
a little space for partition 7:

###################################
unit: sectors

/dev/sde1 : start=     4096, size= 26613760, Id= 7
/dev/sde2 : start= 26619705, size= 12289725, Id= 7
/dev/sde3 : start= 38909430, size= 10233405, Id= 7
/dev/sde4 : start= 49142835, size=927625230, Id= 5
/dev/sde5 : start= 49142898, size= 49158837, Id=82
/dev/sde6 : start= 98304000, size=  1024000, Id=83, bootable
/dev/sde7 : start= 99330048, size= 91136592, Id=83
/dev/sde8 : start=190466703, size= 61448562, Id=83
/dev/sde9 : start=251915328, size= 57351987, Id=83
/dev/sde10: start=309270528, size=152190976, Id=83
###################################

That leaves one 63-sector "track" between the partitions, which
is consistent with the way the other logical partitions are
arranged.  The amount you gain in partition 7 isn't much, though,
just 4187 KB.  Your choice.

Personally, I keep my partitions aligned at multiples of 8 sectors
(4K alignment) just in case I someday transfer the image to a drive
with 4KB physical sectors. Since the rest of your partitions aren't
aligned that way anyway, there's not much point in doing that for
just these two partitions.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.



More information about the users mailing list