Package: util-linux
Version: 2.12p-4

We tried to partition a big USB drive with sfdisk.  But sfdisk refused
to partition it.  The drive has 1.2TB capacity.  It has over 2^31
sector counts.



# cat /proc/scsi/scsi 
Attached devices:
Host: scsi3 Channel: 00 Id: 00 Lun: 00
  Vendor: I-O DATA Model: HDZ-UE1.2TS      Rev: 5601
  Type:   Direct-Access                    ANSI SCSI revision: 02
# echo 0,,b | sfdisk /dev/sdb
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 145935 cylinders, 255 heads, 63 sectors/track
Old situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+ 145934  145935- 1172222887   83  Linux
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty
no room for partition descriptor

sfdisk: bad input


So I made a patch as follows:


--- util-linux-2.12.orig/fdisk/sfdisk.c
+++ util-linux-2.12/fdisk/sfdisk.c

@@ -1869,6 +1888,7 @@
     else
       delta = 0;
     if (delta < 0) {
+#if 0 /*@@@@@*/
        p->start -= delta;
        p->size += delta;
        if (is_extended(p->p.sys_type) && boxes == ONESECTOR)
@@ -1877,6 +1897,17 @@
            warn(_("no room for partition descriptor\n"));
            return 0;
        }
+#else
+       unsigned long old_size = p->size;
+       p->start -= delta;
+       p->size += delta;
+       if (is_extended(p->p.sys_type) && boxes == ONESECTOR)
+         p->size = inc;
+       else if ( old_size <= -delta ) {
+           warn(_("no room for partition descriptor\n"));
+           return 0;
+       }
+#endif
     }
     base = (!ep ? 0
                : (is_extended(p->p.sys_type) ?




Here is the screenshot of pathed version of sfdisk.

# echo 0,,b | ./sfdisk /dev/s
db
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 145935 cylinders, 255 heads, 63 sectors/track
Old situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+ 145934  145935- 1172222887   83  Linux
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty
New situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+ 145934  145935- 1172222887    b  W95 FAT32
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       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 ...

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).)
#


The environment is:

CPU: IOP80219 (Xscale)
Distro: Debian 3.1 (sarge)
Kernel: Linux 2.6.10-iop1
        ( 2.6.10 + intel patch )
libc: 2.3.2.ds1-22


This is ARM machine, but this bug affects most of 32bit architectures,
I think...

Thanks.
-- 
_._. __._  _ . ... _  .___ ._. _____ _... ._ _._ _.._. .____  _ . ... _

                                                          Kunihiko IMAI


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to