Util-Linux package development
 help / color / mirror / Atom feed
* (no subject)
@ 2013-12-11 18:15 Scott Moser
  0 siblings, 0 replies; only message in thread
From: Scott Moser @ 2013-12-11 18:15 UTC (permalink / raw)
  To: util-linux

It seems that for disks larger than the maximum size addressable by MBR sfdisk behaves oddly.

I would have expected:
  echo "2048,,L" | sfdisk -uS --Linux $TARGET

to put a 2TB partition on $TARGET if it was larger than 2TB.
I suspect that the issue is the end sector that its trying to write
overflowing an integer.

I'll suggest that a better action would be to just end at 2TB.

I don't think this is a terribly severe bug, or that my suggestion is the
right way to fix it.  Mostly I'm just reporting the odd/unexpected (to me)
behavior.

See below for example, the same is true on file or block device.

Scott
----

$ rm -f /tmp/foo.img; truncate --size 2500G /tmp/foo.img
$ echo "2048,,L" | sfdisk -uS --Linux /tmp/foo.img
Warning: /tmp/foo.img is not a block device
Disk /tmp/foo.img: cannot get geometry

Disk /tmp/foo.img: 326354 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /tmp/foo.img: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/tmp/foo.img1          2048 5242879999 5242877952  83  Linux
/tmp/foo.img2             0         -          0   0  Empty
/tmp/foo.img3             0         -          0   0  Empty
/tmp/foo.img4             0         -          0   0  Empty
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table

Re-reading the partition table ...
BLKRRPART: Inappropriate ioctl for device

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

$ sfdisk -uS -l /tmp/foo.img
Disk /tmp/foo.img: cannot get geometry

Disk /tmp/foo.img: 326354 cylinders, 255 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/tmp/foo.img1          2048 947912703  947910656  83  Linux
/tmp/foo.img2             0         -          0   0  Empty
/tmp/foo.img3             0         -          0   0  Empty
/tmp/foo.img4             0         -          0   0  Empty



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-11 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 18:15 Scott Moser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox