Public bug reported:

If you try and specify the starting offset for the partition in sectors
and ask sfdisk to use the rest of the disk (with "+"), sfdisk will
incorrectly calculate the end cylinders and not create the partition.
For example

---

# dd if=/dev/zero of=/tmp/disk.img bs=1M count=10
# losetup -f /tmp/disk.img
# sfdisk -uS /dev/loop1 <<EOF
2048 + L *
0 0;
0 0;
0 0;
EOF
Checking that no-one is using this disk right now ...
BLKRRPART: Invalid argument
OK
Disk /dev/loop1: cannot get geometry

Disk /dev/loop1: 1 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/loop1: unrecognized partition table type
Old situation:
No partitions found
New situation:
Warning: The partition table looks like it was made
  for C/H/S=*/71/5 (instead of 1/255/63).
For this listing I'll assume that geometry.
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/loop1p1   *      2048     20479      18432  83  Linux
                start: (c,h,s) expected (5,54,4) found (0,32,33)
                end: (c,h,s) expected (57,48,5) found (1,70,5)
/dev/loop1p2             0         -          0   0  Empty
/dev/loop1p3             0         -          0   0  Empty
/dev/loop1p4             0         -          0   0  Empty
Warning: partition 1 does not end at a cylinder boundary
end of partition 1 has impossible value for cylinders: 1 (should be in 0-0)

sfdisk: I don't like these partitions - nothing changed.
(If you really want this, use the --force option.)

---

Using the --force flag writes out the correct partitions.  I also note
this is fixed in 2.26, which has a large rewrite of sfdisk and uses
sectors by default

** Affects: util-linux (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to util-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1481158

Title:
  sfdisk gets cylinder calculation wrong when using sectors

Status in util-linux package in Ubuntu:
  New

Bug description:
  If you try and specify the starting offset for the partition in
  sectors and ask sfdisk to use the rest of the disk (with "+"), sfdisk
  will incorrectly calculate the end cylinders and not create the
  partition.  For example

  ---

  # dd if=/dev/zero of=/tmp/disk.img bs=1M count=10
  # losetup -f /tmp/disk.img
  # sfdisk -uS /dev/loop1 <<EOF
  2048 + L *
  0 0;
  0 0;
  0 0;
  EOF
  Checking that no-one is using this disk right now ...
  BLKRRPART: Invalid argument
  OK
  Disk /dev/loop1: cannot get geometry

  Disk /dev/loop1: 1 cylinders, 255 heads, 63 sectors/track

  sfdisk: ERROR: sector 0 does not have an msdos signature
   /dev/loop1: unrecognized partition table type
  Old situation:
  No partitions found
  New situation:
  Warning: The partition table looks like it was made
    for C/H/S=*/71/5 (instead of 1/255/63).
  For this listing I'll assume that geometry.
  Units = sectors of 512 bytes, counting from 0

     Device Boot    Start       End   #sectors  Id  System
  /dev/loop1p1   *      2048     20479      18432  83  Linux
                start: (c,h,s) expected (5,54,4) found (0,32,33)
                end: (c,h,s) expected (57,48,5) found (1,70,5)
  /dev/loop1p2             0         -          0   0  Empty
  /dev/loop1p3             0         -          0   0  Empty
  /dev/loop1p4             0         -          0   0  Empty
  Warning: partition 1 does not end at a cylinder boundary
  end of partition 1 has impossible value for cylinders: 1 (should be in 0-0)

  sfdisk: I don't like these partitions - nothing changed.
  (If you really want this, use the --force option.)

  ---

  Using the --force flag writes out the correct partitions.  I also note
  this is fixed in 2.26, which has a large rewrite of sfdisk and uses
  sectors by default

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1481158/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to