On Sunday 30 August 2009 21:28, walter harms wrote:
> 
> walter harms schrieb:
> > 
> > Matthew Stoltenberg schrieb:
> >>>>> and sfdisk is a very nice tool to create partitions from scripts. beats
> >>>>> parted.
> >> agreed...  sfdisk is nice for scripted installs...  I would be willing
> >> to do a bit of testing for this.
> >>
> >>>> our fdisk should be massaged into an sfdisk. Would be handy IMHO,
> >>>> agreed.
> >>> interessting would be a tools that can handle disk >2TB. fdisk (and 
> >>> friends) cannot
> >>> if i am informed correctly. This will make BB interessting for SAN.
> >> really?  I think it wouldn't be that hard to use long long for pointers...
> >>
> >> course, on top of all this, we still would need a utility to put a
> >> filesystem on there since e2fsutils got pulled from the package.
> >>
> > 
> > The partition schema has problems with >2TB, so there is more that simply 
> > using a larger datatype,
> > 2 TB is restriction of DOS partiton format.
> > 
> > see here and others:
> > * 
> > http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html
> > 
> 
> I drop over an article concerning the >2TB problem:
> http://www.ibm.com/developerworks/linux/library/l-gpt/index.html
> it mention an GPT aware fdisk (aka gdisk).
> http://sourceforge.net/projects/gptfdisk/files/
> 
> maybe some will take a look a gdisk.

For now, I am adding a warning so that we can at least
work correctly with 1st 2TB of such big devices:


+static sector_t bb_BLKGETSIZE_sectors(int fd)
 {
        uint64_t v64;
        unsigned long longsectors;

        if (ioctl(fd, BLKGETSIZE64, &v64) == 0) {
                /* Got bytes, convert to 512 byte sectors */
-               return (v64 >> 9);
+               v64 >>= 9;
+               if (v64 != (sector_t)v64) {
+ ret_trunc:
+                       /* Not only DOS, but all other partition tables
+                        * we support can't record more than 32 bit
+                        * sector counts or offsets
+                        */
+                       bb_error_msg("device has more than 2^32 sectors, can't 
use all of them");
+                       v64 = (uint32_t)-1L;
+               }
+               return v64;
        }
        /* Needs temp of type long */
        if (ioctl(fd, BLKGETSIZE, &longsectors))
                longsectors = 0;
+       if (sizeof(long) > sizeof(sector_t)
+        && longsectors != (sector_t)longsectors
+       ) {
+               goto ret_trunc;
+       }
        return longsectors;
 }


--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to