Re: Problems with Toshiba SD-W2002 DVD-RAM drive (IDE)

Stefan Jaschke
2001-04-21T16:47:54Z

Hi Jens,

I took some time to try to understand why "mke2fs -b 2048 /dev/hdc"
wants 500MB memory. Here is a first explanation:
# mke2fs -m 0 -n /dev/hdc
mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
406650880 inodes, 813284544 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
24820 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group

813284544 4k blocks would be 3.7 Terabyte.
(Strangely enough, calling mke2fs with any blocksize parameter results in a memory
allocation larger then my memory available.)

I took some more time to understand at what point the wrong size is introduced.
I got the source rpm, set CFLAGS to "-g", ran gdb, and nailed down the point:

(gdb) l
80 #endif
81 if (fd < 0)
82 return errno;
83
84 #ifdef BLKGETSIZE
85 if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
86 close(fd);
87 *retblocks = size / (blocksize / 512);
88 return 0;
89 }
(gdb) n
86 close(fd);
(gdb) print size
$1 = -2083658236
(gdb) bt
#0 ext2fs_get_device_size (file=0xbffff911 "/dev/hdc", blocksize=1024,
retblocks=0xbffff534) at ../../../lib/ext2fs/getsize.c:86
#1 0x804aca3 in PRS (argc=4, argv=0xbffff75c) at ../../misc/mke2fs.c:993
#2 0x804af2e in main (argc=4, argv=0xbffff75c) at ../../misc/mke2fs.c:1081
#3 0x40044baf in __libc_start_main () from /lib/libc.so.6

I am afraid I'd need help to go deeper.

Cheers,
Stefan J.

--
Stefan R. Jaschke <stefan@jaschke-net.de>