On disks larger than 512GiB, mac-fdisk suggests the wrong disk size. The below is what happened when I was setting up my 750GB Hitachi disks. livecd ~ # egrep 'name|sda' /proc/partitions major minor #blocks name 8 0 732574584 sda ===== So that is in 1Kb blocks. Now notice below how it suggests 1073741825 as the number of (512-byte) blocks on the device. That number is 30-bits, so I suspect the code is using a signed 32-bit integer somewhere, needs to be a 64-bit unsigned to be safe (I don't have any devices over 2TiB to test that on). It works fine once I tell it the correct number of blocks on the device, but this stuff might confuse some users. livecd ~ # mac-fdisk /dev/sda /dev/sda Command (? for help): p No partition map exists Command (? for help): i size of 'device' is 1073741825 blocks: new size of 'device' is 1073741825 blocks Command (? for help): p /dev/sda # type name length base ( size ) system /dev/sda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sda2 Apple_Free Extra 1073741761 @ 64 (512.0G) Free space Block size=512, Number of Blocks=1073741825 DeviceType=0x0, DeviceId=0x0 Command (? for help): i map already exists do you want to reinit? [n/y]: y size of 'device' is 1073741825 blocks: 1465149168 new size of 'device' is 1465149168 blocks Command (? for help): p /dev/sda # type name length base ( size ) system /dev/sda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sda2 Apple_Free Extra 1465149104 @ 64 (698.6G) Free space Block size=512, Number of Blocks=1465149168 DeviceType=0x0, DeviceId=0x0
Created attachment 139155 [details, diff] Compute Disk Size Patch Can you please try this patch, then run mac-fdisk again? It should print some debug info about how it determined the size of the disk. Thanks!
# ./pdisk /dev/sdb stat: mode = 060640, type=Block size = 0, blocks = 0 BLKGETSIZE:size in blocks = 1465149168 HDIO_GETGEO: heads=255, sectors=63, cylinders=25665, start=0, total=412308225 llseek to end of device failed on second try /dev/sdb Command (? for help): i map already exists do you want to reinit? [n/y]: y stat: mode = 060640, type=Block size = 0, blocks = 0 BLKGETSIZE:size in blocks = 1465149168 HDIO_GETGEO: heads=255, sectors=63, cylinders=25665, start=0, total=412308225 llseek to end of device failed on second try size of 'device' is 1073741825 blocks: new size of 'device' is 1073741825 blocks Command (? for help): p /dev/sdb # type name length base ( size ) system /dev/sdb1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sdb2 Apple_Free Extra 1073741761 @ 64 (512.0G) Free space Block size=512, Number of Blocks=1073741825 DeviceType=0x0, DeviceId=0x0 Command (? for help):
This should be fixed in mac-fdisk-1.0.6-r7, but I think we're still limited to up to 2TB disks. I think this might be a limitation of the disk label, but I'm not 100% sure.