I've knocked up a simple util to create NTFS partitions (mkntfs, surprisingly);
it uses the BLKGETSIZE ioctl to get the size of the block device.
My partition table looks like this:
Disk /dev/hdc: 255 heads, 63 sectors, 523 cylinders
Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID
1 00 1 1 0 254 63 260 63 4192902 a6
2 00 0 1 329 254 63 455 5285385 2040255 05
3 00 0 1 263 254 63 328 4225095 1060290 83
4 00 0 1 456 254 63 522 7325640 1076355 83
5 00 1 1 329 254 63 330 63 32067 07 <--
6 00 1 1 331 254 63 332 63 32067 07
I'm trying to write to /dev/hdc5 (indicated).
BLKGETSIZE is reporting the size of the block device as 32067 sectors; but
I can't write to the last sector. Neither can dd:
loth:~# dd if=/dev/zero of=/dev/hdc5 bs=512 seek=32066 count=1
dd: /dev/hdc5: No space left on device
1+0 records in
0+0 records out
loth:~# dd if=/dev/zero of=/dev/hdc5 bs=512
dd: /dev/hdc5: No space left on device
32067+0 records in
32066+0 records out
It seems mke2fs, mkswap, mkfs.minix, etc., don't get hit by this because they
round the partition size to a multiple of their block size, which doesn't fall
below 1024.
genhd.c:resetup_one_dev() does
dev->sizes[i] = dev->part[i].nr_sects >> (BLOCK_SIZE_BITS - 9 );
Which seems to be stopping me from accessing the last sector; is this a bug
or a feature?
Pointers to what I'm (or the code) is doing wrong would be much appreciated.
Oh, this is all 2.2.5, if that's relevant.
-- "His mind is like a steel trap -- full of mice"- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/