Re: 2048 bytes/sector media in 2.2.12

Benjamin Carter (bcarter@umr.edu)
Tue, 31 Aug 1999 20:05:00 -0500


On Tue, Aug 31, 1999 at 10:07:37PM +0100, Alan Cox wrote:
> > So now that 2.2 is out, he wants me to upgrade to 2.2 (I also noted that
> > apparently the partitioning in 2.1 counts the sectors as if they were
> > all 512 bytes long, leaving the values all multiplied by 4. Is this
> > correct?). However, when I went to re-partition the drive under 2.2.12, I
>
> It is for M/O disks and removable media. FOr hard disks I dont know.
>
> > > fdisk -b 2048 /dev/sda
> > ll_rw_block: device 08:00: only 2048-char blocks implemented (1024)
>
> Your fdisk tried to issue a small write to a large media device. Can you
> strace that bit of it

After looking through the strace (and my original problem) - I see that
the read which is giving me trouble is in read_extended(). Naturally
since the change in 2.2, the entry in the main partition table points to
a sector somewhere which isn't the one containing the extended
partition - and may even be beyond the end of the disk as the previous
extended partition was in the 8-9 gig area.

However, after dd-ing /dev/zero over the first sector (the partition
table), the same error (from ll_rw_block) still occurs. Viewing the
strace output (included below) makes it appear as though the HDIO_GETGEO
ioctl() call is the one that produces the printk(), as it appears before
the first output from fdisk on the console. (4 lines after the open()
on /dev/sda, so it must be in there somewhere.) This appears to solve
my immediate problem, as fdisk no longer dies with the failed read.

execve("./fdisk", ["./fdisk", "-b", "2048", "/dev/sda"], [/* 24 vars */]) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40007000
mprotect(0x40000000, 20881, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
mprotect(0x8048000, 69708, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=4853, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY) = 4
mmap(0, 4853, PROT_READ, MAP_SHARED, 4, 0) = 0x40008000
close(4) = 0
stat("/etc/ld.so.preload", 0xbffffae0) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.5", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3"..., 4096) = 4096
mmap(0, 794624, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000a000
mmap(0x4000a000, 562371, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 0) = 0x4000a000
mmap(0x40094000, 20304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 0x89000) = 0x40094000
mmap(0x40099000, 207288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40099000
close(4) = 0
mprotect(0x4000a000, 562371, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
munmap(0x40008000, 4853) = 0
mprotect(0x8048000, 69708, PROT_READ|PROT_EXEC) = 0
mprotect(0x4000a000, 562371, PROT_READ|PROT_EXEC) = 0
mprotect(0x40000000, 20881, PROT_READ|PROT_EXEC) = 0
personality(PER_LINUX) = 0
geteuid() = 0
getuid() = 0
getgid() = 0
getegid() = 0
brk(0x805d60c) = 0x805d60c
brk(0x805e000) = 0x805e000
stat("/etc/locale/C/libc.cat", 0xbffff614) = -1 ENOENT (No such file or directory)
stat("/usr/share/locale/C/libc.cat", 0xbffff614) = -1 ENOENT (No such file or directory)
stat("/usr/share/locale/libc/C", 0xbffff614) = -1 ENOENT (No such file or directory)
stat("/usr/share/locale/C/libc.cat", 0xbffff614) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/locale/C/libc.cat", 0xbffff614) = -1 ENOENT (No such file or directory)
open("/dev/sda", O_RDWR) = 4
fstat(4, {st_mode=S_IFBLK|0640, st_rdev=makedev(8, 0), ...}) = 0
read(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2048) = 2048
ioctl(4, HDIO_GETGEO, 0xbffffa78) = 0
write(2, "Device contains neither a valid "..., 78) = 78
write(2, "Building a new DOS disklabel. Ch"..., 165) = 165
fstat(1, {st_mode=S_IFCHR|0720, st_rdev=makedev(4, 1), ...}) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40008000
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "\n", 1) = 1
fstat(0, {st_mode=S_IFCHR|0720, st_rdev=makedev(4, 1), ...}) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40009000
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "Command (m for help): ", 22) = 22
read(0, "q\n", 4096) = 2
close(4) = 0
_exit(0) = ?

-- 
-Ben Carter
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so. - Douglas Adams, "Last Chance to See" 

- 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/