* What can you do about corrupt disk blocks? @ 2000-10-11 4:00 ed 2000-10-11 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. 2000-10-11 4:00 ` Eric Bennett 0 siblings, 2 replies; 5+ messages in thread From: ed @ 2000-10-11 4:00 UTC (permalink / raw) Can anyone advise: I had a disk with corrupt blocks on it recently. To get the system up and running again, I had to reset the bad blocks with fsck at boot up to get the disk mounted again. Is it possible in any way to back up the disk before resetting any blocks? (say using dd, to do a block by block copy) Is it possible to recover the blocks when fsck says it cannot read them? Thanks for any information or advice. ed Sent via Deja.com http://www.deja.com/ Before you buy. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What can you do about corrupt disk blocks? 2000-10-11 4:00 What can you do about corrupt disk blocks? ed @ 2000-10-11 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. 2000-10-12 4:00 ` ed 2000-10-11 4:00 ` Eric Bennett 1 sibling, 1 reply; 5+ messages in thread From: Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 2000-10-11 4:00 UTC (permalink / raw) In article <8s1a9h$qjk$1@nnrp1.deja.com>, ed <ed2323@my-deja.com> writes: >Can anyone advise: I had a disk with corrupt >blocks on it recently. To get the system up and >running again, I had to reset the bad blocks >with fsck at boot up to get the disk mounted again. For what it is worth, fsck doesn't do anything to directly fix the bad block. The bad block handling of most disks, the kernel and/or controller subsystem can replace the block on a write since they have known data to put into it. When fsck clears a block, the overwrite is probably what causes the block to replaced. > >Is it possible in any way to back up the disk before resetting >any blocks? (say using dd, to do a block by block copy) Odds are, the disk is trying as hard as is likely to succeed, if it can succeed, to read the block before it gives up. You could try re-reading it a lot of time and you might get good data. You might also get an undetected read error; the disk thinks it got a good copy, but didn't. That's can be worse than getting a bad block. >Is it possible to recover the blocks when fsck says it >cannot read them? Depends on what is in the block. Bad blocks in a directory will simply cause the directory to be cleared, unlinking the files. fsck has a pass that notices this and will relink any files to the lost+found directory. You lose the directory structure and names for those files, but not the data in them. If you can identify the affected files, the data in them may not matter; object files created from a compiler step. Or, you can restore the data from a recent backup. What you need to do is record all the blocks that fsck can't read and identify what they're used for. In many cases fsck will say, but you can also use icheck. Once you know what affect cleaning the file system will have you can take appropriate recovery actions. It is worth noting that fsck doesn't read data block of most files. It will read data blocks for directories, since that affects the file system organization. Everything else it reads is file system meta-data. The types of blocks affected: Superblock - There are backup copies of the superblock scattered across the disk. The first one is always block 32. For file systems created during the system installation the logs of of these backups are kept somewhere under /var/adm. The newfs command can also be coereced to print the block numbers for a given set of parameters without trying to write the file system. Cylinder group block - There is one of these per cylinder group. Must of the information can be regenerated from the superblock and most of the rest from the file system once consistent. Inode blocks - Each inode data structure represents one file. There are four of these data structure per disk sector. About all that can be done for a bad block is to clear it. What you'll want to do is record the inode numbers, see if you can determine what file is about to be obliterated and plan accordingly. If the block can't be read, there isn't much choice except to clear it, but at least you'll know what file is lost. Indirect blocks - UFS stores block addresses of file data at three levels; direct block addresses in the inode and three levels of indirect block. The indirect blocks are the address blocks which store addresses. Each level address more and more space; direct blocks: 96 KB 1st indirect block: 16 MB 2nd indirect block: 32 GB 3rd indirect block: 64 TB The 3rd indirect block can allow a file to address far more space than the 32 bit block counter can track, so file size and file system size are limited by the block counter not the 3rd indirect block. Losing an indirect block causes the corresponding amount of storage in that file to be lost. For an I/O error here, you'll probably just have to restore the file from a backup. Directory blocks - As noted earlier, this only causes the file name to be lost. The inode is unaffected by an I/O error on the directory block. Cylinder group summary - This can always be regenerated from the cylinder group blocks. If you have bad blocks in the file system meta-data, there's a fair chance you also have them in the file data. As I noted earlier, fsck doesn't look at those blocks. You can use dd(1) for a simple scan or scu(8) for a scan of SCSI connected disks. The backplane RAID controller, probably have their own utility. Many bad blocks scattered out over the disk, and that's probably a hint that the disk needs to be replaced... > >Thanks for any information or advice. > >ed > > >Sent via Deja.com http://www.deja.com/ >Before you buy. > -- Alan Rollow alan@nabeth.cxo.dec.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What can you do about corrupt disk blocks? 2000-10-11 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 2000-10-12 4:00 ` ed 2000-10-12 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. 0 siblings, 1 reply; 5+ messages in thread From: ed @ 2000-10-12 4:00 UTC (permalink / raw) Thanks the for the post especially Alan's details on the file systems. Are there any good docs on the web that explain layout of cylinder group and superblocks etc and is the layout specific just to tru64 UFS or is it the same for any UFS, eg on Sun or aix etc. Thanks, ed. > If you have bad blocks in the file system meta-data, there's > a fair chance you also have them in the file data. As I > noted earlier, fsck doesn't look at those blocks. You can > use dd(1) for a simple scan or scu(8) for a scan of SCSI > connected disks. The backplane RAID controller, probably > have their own utility. > > Many bad blocks scattered out over the disk, and that's > probably a hint that the disk needs to be replaced... > > > > >Thanks for any information or advice. > > > >ed > > > > > >Sent via Deja.com http://www.deja.com/ > >Before you buy. > > > > -- > Alan Rollow alan@nabeth.cxo.dec.com > > Sent via Deja.com http://www.deja.com/ Before you buy. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What can you do about corrupt disk blocks? 2000-10-12 4:00 ` ed @ 2000-10-12 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. 0 siblings, 0 replies; 5+ messages in thread From: Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 2000-10-12 4:00 UTC (permalink / raw) In article <8s3r16$ts8$1@nnrp1.deja.com>, ed <ed2323@my-deja.com> writes: >Thanks the for the post especially Alan's details on the file >systems. Are there any good docs on the web that explain >layout of cylinder group and superblocks etc and is the layout >specific just to tru64 UFS or is it the same for any UFS, eg >on Sun or aix etc. I think the 4.3BSD Internals book has a chapter on file system organization. Some of the BSD papers on the fast file system may be out there somewhere. The vendor include files (where present) are also a good source of information for some of the data structure details of the file system. As for the differences it really depends on whether a particular vendor considers the changes they've made warrant a new name for the file system. Some vendor could make very minor changes to some data structures and decide the file system deserves a different name. Another vendor could significantly change the layout, but chose not to change the name. I know that the Solaris and Tru64 UNIX implementations are still pretty close at least at level of basic on-disk data structures. The short version of the layout is: The beginning of a disk/volume/partition has a boot block and the primary copy of the superblock. For whole disks this is generally where the disk label or volume table of content will be. However, this is very vendor specific. After these two blocks all cylinder groups share the same basic layout; free space (could be zero), backup superblock, cylinder group block, inode table, free space. Most implementations will have macros that can be applied to the superblock and cylinder group block to get the on-disk address of the various data structures. The amount of free space in front of the backup superblock varies as you work through the cylinder groups. If the geometry information is accurate (not likely these days), it prevent the backup superblock from ending up on a single surface. Since a head crash will tend to take out that surface more "reliably" than the ones around it, the progression protects the superblock from some types of failure. While the geometry of most/all modern disks varies, the assumptions made for this progressive layout are unlikely to create the reverse situation of having the backup superblocks all on the same surface. Just a guess though. Inode layout may also be different, but switching from the direct/ indirect block address scheme is a pretty major change that would warrant the marketing value of a vendor saying they have a new file system. >Thanks, >ed. > >> -- >> Alan Rollow alan@nabeth.cxo.dec.com >Sent via Deja.com http://www.deja.com/ >Before you buy. > -- Alan Rollow alan@nabeth.cxo.dec.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What can you do about corrupt disk blocks? 2000-10-11 4:00 What can you do about corrupt disk blocks? ed 2000-10-11 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. @ 2000-10-11 4:00 ` Eric Bennett 1 sibling, 0 replies; 5+ messages in thread From: Eric Bennett @ 2000-10-11 4:00 UTC (permalink / raw) In article <8s1a9h$qjk$1@nnrp1.deja.com>, ed <ed2323@my-deja.com> wrote: > Can anyone advise: I had a disk with corrupt > blocks on it recently. To get the system up and > running again, I had to reset the bad blocks > with fsck at boot up to get the disk mounted again. > > Is it possible in any way to back up the disk before resetting > any blocks? (say using dd, to do a block by block copy) > > Is it possible to recover the blocks when fsck says it > cannot read them? I think the only thing you can do is to repeatedly try reading the block and hope that sooner or later the drive will be able to pick it up correctly. Sometimes if you try reading it enough times, it will be able to read it correctly one time. Of course, the most reliable way of dealing with bad disks is to make regular backups. :-) -- Eric Bennett ( http://www.pobox.com/~ericb/ ) Cornell University / Chemistry & Chemical Biology Lighthouse, n. A tall building on the seashore in which the government maintains a lamp and the friend of a politician. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2000-10-12 4:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2000-10-11 4:00 What can you do about corrupt disk blocks? ed 2000-10-11 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. 2000-10-12 4:00 ` ed 2000-10-12 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. 2000-10-11 4:00 ` Eric Bennett
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox