From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9604190625.AA06295@nova.tat.physik.uni-tuebingen.de> Date: Fri, 19 Apr 1996 02:45:02 +0200 (MET DST) From: Harald Koenig Subject: Re: bad blocks on SCSI disk with NCR 810 controller :-( In-Reply-To: <199604182010.QAA03726@bip.anatomy.upenn.edu> > > 2) the other nasty thing is that there is no tool to check or print the > > bad blocks marked in a ext2fs (linked to inode #1) which makes it impossible> > to check if "e2fsck" did work correctly (other than hacking the e2fsck > > sources of course). > > > Check out the dumpe2fs command with "man dumpe2fs". > I think it does what you want. you're right but it wasn't that obvious (i did run dumpe2fs before) since the man page doesn't mention bad blocks and the current version (e2fsprogs-1.02) of dumpe2fs and debugfs are not 64bit-clean. thus dumpe2fs locked up for Linux/AXP in the first ctime() call since the ext2fs timestamps are 32bit and ctime gets passed a pointer to 64bit time_t... here is a small sample which shows the problem (and producing an unaligned trap too) ------------------------------------------------------------------------------- #include main() { struct ext2_super_block s; s.s_mtime = 829857997; s.s_wtime = 829857997; s.s_lastcheck = 829857997; printf("%s\n",ctime(&s.s_mtime)); printf("done...\n"); } ------------------------------------------------------------------------------- and here is a fix for this ctime() problems for e2fsprogs-1.02. maybe it would look better to use a wrapper function for ctime() ?! ------------------------------------------------------------------------------- --- e2fsprogs-1.02/lib/e2p/ls.c.ORIG Mon Oct 30 23:44:05 1995 +++ e2fsprogs-1.02/lib/e2p/ls.c Fri Apr 19 02:23:04 1996 @@ -45,6 +45,7 @@ void list_super (struct ext2_super_block * s) { + time_t tm; printf ("Filesystem magic number: 0x%04X\n", s->s_magic); printf ("Filesystem state: "); print_fs_state (stdout, s->s_state); @@ -63,11 +64,14 @@ printf ("Blocks per group: %u\n", s->s_blocks_per_group); printf ("Fragments per group: %u\n", s->s_frags_per_group); printf ("Inodes per group: %u\n", s->s_inodes_per_group); - printf ("Last mount time: %s", ctime ((time_t *) &s->s_mtime)); - printf ("Last write time: %s", ctime ((time_t *) &s->s_wtime)); + tm = s->s_mtime; + printf ("Last mount time: %s", ctime (&tm)); + tm = s->s_wtime; + printf ("Last write time: %s", ctime (&tm)); printf ("Mount count: %u\n", s->s_mnt_count); printf ("Maximum mount count: %d\n", s->s_max_mnt_count); - printf ("Last checked: %s", ctime ((time_t *) &s->s_lastcheck)); + tm = s->s_lastcheck; + printf ("Last checked: %s", ctime (&tm)); printf ("Check interval: %u\n", s->s_checkinterval); if (s->s_checkinterval) { --- e2fsprogs-1.02/debugfs/debugfs.c.ORIG Thu Sep 7 05:18:50 1995 +++ e2fsprogs-1.02/debugfs/debugfs.c Fri Apr 19 02:29:56 1996 @@ -164,6 +164,7 @@ { int i; FILE *out; + time_t tm; if (argc > 1) { com_err(argv[0], 0, "Usage: show_super"); @@ -174,8 +175,10 @@ out = open_pager(); fprintf(out, "Filesystem is read-%s\n", fs->flags & EXT2_FLAG_RW ? "write" : "only"); - fprintf(out, "Last mount time = %s", ctime(&fs->super->s_mtime)); - fprintf(out, "Last write time = %s", ctime(&fs->super->s_wtime)); + tm = fs->super->s_mtime; + fprintf(out, "Last mount time = %s", ctime(&tm)); + tm = fs->super->s_wtime; + fprintf(out, "Last write time = %s", ctime(&tm)); fprintf(out, "Mount counts = %d (maximal = %d)\n", fs->super->s_mnt_count, fs->super->s_max_mnt_count); fprintf(out, "Superblock size = %d\n", sizeof(struct ext2_super_block)); @@ -246,6 +249,7 @@ { const char *i_type; FILE *out; + time_t tm; out = open_pager(); if (LINUX_S_ISDIR(inode.i_mode)) i_type = "directory"; @@ -269,15 +273,19 @@ fprintf(out, "Fragment: Address: %d Number: %d Size: %d\n", inode.i_faddr, inode.i_frag, inode.i_fsize); #endif + tm = inode.i_ctime; fprintf(out, "ctime: 0x%08x -- %s", inode.i_ctime, - ctime(&inode.i_ctime)); + ctime(&tm)); + tm = inode.i_atime; fprintf(out, "atime: 0x%08x -- %s", inode.i_atime, - ctime(&inode.i_atime)); + ctime(&tm)); + tm = inode.i_mtime; fprintf(out, "mtime: 0x%08x -- %s", inode.i_mtime, - ctime(&inode.i_mtime)); + ctime(&tm)); + tm = inode.i_dtime; if (inode.i_dtime) fprintf(out, "dtime: 0x%08x -- %s", inode.i_dtime, - ctime(&inode.i_dtime)); + ctime(&tm)); if (LINUX_S_ISLNK(inode.i_mode) && inode.i_blocks == 0) fprintf(out, "Fast_link_dest: %s\n", (char *)inode.i_block); else ------------------------------------------------------------------------------- Harald -- All SCSI disks will from now on ___ _____ be required to send an email notice 0--,| /OOOOOOO\ 24 hours prior to complete hardware failure! <_/ / /OOOOOOOOOOO\ \ \/OOOOOOOOOOOOOOO\ \ OOOOOOOOOOOOOOOOO|// Harald Koenig, \/\/\/\/\/\/\/\/\/ Inst.f.Theoret.Astrophysik // / \\ \ koenig@tat.physik.uni-tuebingen.de ^^^^^ ^^^^^