Util-Linux package development
 help / color / mirror / Atom feed
From: Scott Moser <smoser@ubuntu.com>
To: util-linux@vger.kernel.org
Date: Wed, 11 Dec 2013 13:15:27 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1312111313490.4340@brickies> (raw)

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



                 reply	other threads:[~2013-12-11 18:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1312111313490.4340@brickies \
    --to=smoser@ubuntu.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox