Skip to contentSkip to conversation

sfdisk 2.20.1 --no-reread do BLKRRPART

DISCUSSION Bertrand Jacquin 2 participants 3 messages Feb 16, 2012 – May 21, 2013 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi,

When creating partitions on a destination that is not a block device, sfdisk do a BLKRRPART ioctl even when --no-reread option is used, but looking at documentation --no-reread only apply to the beginning process.

Would it be fine to extend that to the complete process ?

Bertrand

dd if=/dev/zero of=/tmp/disk.img bs=1024 count=4032 strace -fF -s 1024 -e trace=ioctl \
sfdisk --no-reread -C2 -H32 -S63 -q -f \
/tmp/disk.img << EOF
unit: sectors

part1 : start= 63, size= 3969, Id=83
part2 : start= 4032, size= 98784, Id=83
part3 : start= 102816, size= 22176, Id=83
part4 : start= 124992, size= 0, Id=83
EOF

ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fff7b917ce0) = -1 ENOTTY (Inappropriate ioctl for device)
Warning: /tmp/disk.img is not a block device
ioctl(3, HDIO_GETGEO, 0x7fff7b917c10) = -1 ENOTTY (Inappropriate ioctl for device)
Disk /tmp/disk.img: cannot get geometry

ioctl(3, BLKGETSIZE64, 0x7fff7b917be0)  = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, BLKGETSIZE, 0x7fff7b917b18)    = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(3, FDGETPRM, 0x7fff7b917af0)      = -1 ENOTTY (Inappropriate ioctl for device)

Disk /tmp/disk.img: 2 cylinders, 32 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
/tmp/disk.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/disk.img1            63      4031       3969  83  Linux
/tmp/disk.img2          4032    102815      98784  83  Linux
/tmp/disk.img3        102816    124991      22176  83  Linux
/tmp/disk.img4        124992    124991          0  83  Linux

Successfully wrote the new partition table

Re-reading the partition table ...
ioctl(3, BLKRRPART, 0) = -1 ENOTTY (Inappropriate ioctl for device)
BLKRRPART: Inappropriate ioctl for device

Signature · 1 line
Beber
maintainer
#1 lore raw

Sorry for the delay :-)

Quoted 6 lines · Bertrand Jacquin

When creating partitions on a destination that is not a block device, sfdisk do a BLKRRPART ioctl even when --no-reread option is used, but looking at documentation --no-reread only apply to the beginning process.

Would it be fine to extend that to the complete process ?

Not sure, but I think it should be enough to don't call BLKRRPART ioctl for non-block devices.

Quoted 11 lines

dd if=/dev/zero of=/tmp/disk.img bs=1024 count=4032 strace -fF -s 1024 -e trace=ioctl \
sfdisk --no-reread -C2 -H32 -S63 -q -f \
/tmp/disk.img << EOF
unit: sectors

part1 : start= 63, size= 3969, Id=83
part2 : start= 4032, size= 98784, Id=83
part3 : start= 102816, size= 22176, Id=83
part4 : start= 124992, size= 0, Id=83
EOF

...

Quoted 3 lines

Re-reading the partition table ...
ioctl(3, BLKRRPART, 0) = -1 ENOTTY (Inappropriate ioctl for device)
BLKRRPART: Inappropriate ioctl for device

This use case (disk images partitioning) should be fixed in the git tree.

Thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw

Hi,

Quoted 2 lines · « Karel Zak »

Sorry for the delay :-)

No rush at all ! This was only a report about some ugly report in some scripts :)

Quoted 23 lines · Bertrand Jacquin
Quoted 6 lines

When creating partitions on a destination that is not a block device, sfdisk do a BLKRRPART ioctl even when --no-reread option is used, but looking at documentation --no-reread only apply to the beginning process.

Would it be fine to extend that to the complete process ?

Not sure, but I think it should be enough to don't call BLKRRPART ioctl for non-block devices.

Quoted 11 lines

dd if=/dev/zero of=/tmp/disk.img bs=1024 count=4032 strace -fF -s 1024 -e trace=ioctl \
sfdisk --no-reread -C2 -H32 -S63 -q -f \
/tmp/disk.img << EOF
unit: sectors

part1 : start= 63, size= 3969, Id=83
part2 : start= 4032, size= 98784, Id=83
part3 : start= 102816, size= 22176, Id=83
part4 : start= 124992, size= 0, Id=83
EOF

Quoted 8 lines

...

Quoted 3 lines

Re-reading the partition table ...
ioctl(3, BLKRRPART, 0) = -1 ENOTTY (Inappropriate ioctl for device)
BLKRRPART: Inappropriate ioctl for device

This use case (disk images partitioning) should be fixed in the git tree.

Seen and approved ! Thanks Karel

Signature · 4 lines
Bertrand Jacquin, EXOSEC (http://www.exosec.fr/)
ZAC des Metz - 3 Rue du petit robinson - 78350 JOUY EN JOSAS
Tel: +33 1 30 67 60 65  -  Fax: +33 1 75 43 40 70
GSM: +33 6 71 01 70 30  -  mailto:[email protected]