Re: ext2fs superblock updates
On Thu, Nov 16, 2017 at 12:12 PM, Mouse wrote: > >> They are generated by _newfs_ and left untouched thereafter. > > Interesting, thanks. what's so useful about the superblock at newfs > > time? > > It contains enough information for fsck to find other critical things > (like cylinder groups and their inode tables). If the primary > superblock has been destroyed but the rest of the filesystem is intact, > fsck is supposed be able to put the filesystem back together with the > help of a backup superblock. Yes. For UFS filesystems on BSD labeled disks, there's additional hints to fsck about the size of different parts of the filesystem that allow it to guess fairly well at the location of these alternate super blocks. Warner
Re: ext2fs superblock updates
>> They are generated by _newfs_ and left untouched thereafter. > Interesting, thanks. what's so useful about the superblock at newfs > time? It contains enough information for fsck to find other critical things (like cylinder groups and their inode tables). If the primary superblock has been destroyed but the rest of the filesystem is intact, fsck is supposed be able to put the filesystem back together with the help of a backup superblock. > is that for disaster recovery when half my drive is gone and I might > be able to salvage something from a cylinder? Yes...or something has trashed the primary superblock but not (most of) the rest of the filesystem. For example, if you start copying raw disks and carelessly write to the wrong device, and stop it early, you might be able to salvage most of the damaged filesystem that way. In practice, I would say they are largely historical artifacts at this point - I can't remember the last time a backup superblock was of use to me. (It's happened, maybe as many as five times, but the most recent was I-can't-recall-when ago.) They made a lot more sense in the days before disk drives that auto-spare flaky sectors (the superblock gets ovewritten heavily) and sysadmins a significant fraction of whom were competent to do things like manually repair damaged filesystems. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTMLmo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Re: ext2fs superblock updates
On Thu, Nov 16, 2017 at 09:54:44AM -0500, Mouse wrote: > They are generated by _newfs_ and left untouched thereafter. Interesting, thanks. what's so useful about the superblock at newfs time? is that for disaster recovery when half my drive is gone and I might be able to salvage something from a cylinder?
Re: ext2fs superblock updates
>> From the looks of it, the ext2fs code only updates the primary >> superblock: [...] > [...similarity to FFS...] I see two mistakes. ("I will proofread my list posts. I will proofread my list posts. I will proofread my list posts. ...") I was going to ignore the first one, but the other one is actually somewhat important. > I don't know ext2. But I have seen it said that it's basically slimiar s/slimiar/similar/ >[...] Thus, there is never any need to update the > backup superblocks - they are generated by fsck and left untouched > thereafter. They are generated by _newfs_ and left untouched thereafter. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTMLmo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Re: ext2fs superblock updates
> From the looks of it, the ext2fs code only updates the primary > superblock: [...] > I'm under the impression that the secondary ones exist as backups and > are meant to be usable. > Is this wrong or am I misunderstanding things? I don't know ext2. But I have seen it said that it's basically slimiar to FFS, and I do know FFS. If we were talking about FFS instead, I'd say, the backup superblocks are meant to be usable - for fsck. Not for live use. In particular, all the superblock data that FFS mutates in live use is data that fsck knows how to regenerate. Thus, there is never any need to update the backup superblocks - they are generated by fsck and left untouched thereafter. How applicable those remarks are to ext2 depends, of course, on how similar ext2 is to FFS in these respects. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTMLmo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Re: ext2fs superblock updates
Hi. > On 16 Nov 2017, at 10:40, co...@sdf.org wrote: > > From the looks of it, the ext2fs code only updates the primary > superblock: > (…) > I'm under the impression that the secondary ones exist as > backups and are meant to be usable. > > Is this wrong or am I misunderstanding things? As far as I know, Linux does not update backup superblocks under normal operation. Only primary is updated. Backup superblock are always set to “not clean”, so that free blocks/inodes/last mount are expected to be bad there. So this behaviour of ext2fs_sbupdate is most likely correct. Best regards, Radoslaw signature.asc Description: Message signed with OpenPGP
ext2fs superblock updates
Hi folks. >From the looks of it, the ext2fs code only updates the primary superblock: /* * Write a superblock and associated information back to disk. */ int ext2fs_sbupdate(struct ufsmount *mp, int waitfor) { struct m_ext2fs *fs = mp->um_e2fs; struct buf *bp; int error = 0; bp = getblk(mp->um_devvp, SBLOCK, SBSIZE, 0, 0); e2fs_sbsave(&fs->e2fs, (struct ext2fs*)bp->b_data); if (waitfor == MNT_WAIT) error = bwrite(bp); else bawrite(bp); return error; } I'm under the impression that the secondary ones exist as backups and are meant to be usable. Is this wrong or am I misunderstanding things? Thanks.