Reserved first sector for UFS
Isn't the first sector reserved for the boot block in UFS?
Grégoire
=== modified file 'grub-core/fs/ufs.c'
fs/ufs.c +3 -0
@@ -786,6 +786,9 @@ static struct grub_fs grub_ufs_fs =#endif .uuid = grub_ufs_uuid, .mtime = grub_ufs_mtime, +#ifdef GRUB_UTIL + .reserved_first_sector = 1, +#endif .next = 0 };
Quoted 2 lines · Grégoire Sutre
Isn't the first sector reserved for the boot block in UFS?
Depends on OS:
/* The blocks on which the superblock can be found. */ static int sblocklist[] = { 128, 16, 0, 512, -1 };
Quoted 8 lines
Grégoire
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 12 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 3 lines · Grégoire Sutre
Isn't the first sector reserved for the boot block in UFS?
Depends on OS:
/* The blocks on which the superblock can be found. */ static int sblocklist[] = { 128, 16, 0, 512, -1 };
AFAIU:
if (superblock isn't on sector 0) and (inoblk_offs isn't 0 or inode zero isn't used) then first sector is reserved
Quoted 11 lines
Quoted 9 lines
Grégoire
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 17 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 15 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines · Grégoire Sutre
Isn't the first sector reserved for the boot block in UFS?
Depends on OS:
/* The blocks on which the superblock can be found. */ static int sblocklist[] = { 128, 16, 0, 512, -1 };
Quoted 4 lines
AFAIU:
if (superblock isn't on sector 0) and (inoblk_offsisn't 0 or inode zero isn't used) then first sector is reserved
Inode 0 shouldn't be used but I see nothing in the on-disk format to enforce that. Moreover some OSes may put their own information outside of standard basic UFS in the sector 0. Writing to sector 0 of UFS needs more investigation because by now there are a lot of UFS variants
Quoted 14 lines
Quoted 12 lines
Quoted 10 lines
Grégoire
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 2 lines · Grégoire Sutre
Isn't the first sector reserved for the boot block in UFS?
Depends on OS:
/* The blocks on which the superblock can be found. */ static int sblocklist[] = { 128, 16, 0, 512, -1 };
Do you know of any OS that would put the superblock in sector 0? I googled a bit, but I couldn't find examples where UFS would not start with a boot sector (afaics, it usually starts with a bootblock area of at least 8KiB -- with OS-specific data in it, e.g. a disklabel).
Grégoire
Quoted 6 lines · Grégoire Sutre
Quoted 5 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 2 lines · Grégoire Sutre
Isn't the first sector reserved for the boot block in UFS?
Depends on OS:
Quoted 9 lines
Quoted 2 lines
/* The blocks on which the superblock can be found. */ static int sblocklist[] = { 128, 16, 0, 512, -1 };
Do you know of any OS that would put the superblock in sector 0? I googled a bit, but I couldn't find examples where UFS would not start with a boot sector (afaics, it usually starts with a bootblock area of at least 8KiB -- with OS-specific data in it, e.g. a disklabel).
According to *BSD http://fxr.watson.org/fxr/source/ufs/ffs/fs.h:
*/"* Depending on the architecture and the media, the superblock may/* */* reside in any one of four places. For tiny media where every block /* */* counts, it is placed at the very front of the partition. Historically,/* */* UFS1 placed it 8K from the front to leave room for the disk label and/* */* a small bootstrap. For UFS2 it got moved to 64K from the front to leave/* */* room for the disk label and a bigger bootstrap, and for really piggy/* */* systems we check at 256K from the front if the first three fail/*"
Quoted 7 lines
Grégoire
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 8 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 6 lines
Do you know of any OS that would put the superblock in sector 0? I googled a bit, but I couldn't find examples where UFS would not start with a boot sector (afaics, it usually starts with a bootblock area of at least 8KiB -- with OS-specific data in it, e.g. a disklabel).
According to *BSD http://fxr.watson.org/fxr/source/ufs/ffs/fs.h:
Quoted 7 lines
*/"* Depending on the architecture and the media, the superblock may/* */* reside in any one of four places. For tiny media where every block /* */* counts, it is placed at the very front of the partition. Historically,/* */* UFS1 placed it 8K from the front to leave room for the disk label and/* */* a small bootstrap. For UFS2 it got moved to 64K from the front to leave/* */* room for the disk label and a bigger bootstrap, and for really piggy/* */* systems we check at 256K from the front if the first three fail/*"
Interesting. So, when searching for a UFS superblock, sector 0 is a candidate (after sectors 128 and 16). It seems to me that this use of sector 0 for tiny media does not apply to (recent) NetBSD newfs(8), though.
If we want to improve the situation, we could let the filesystem driver dynamically decide whether the first sector is reserved or not. But I'm not sure that it's worth it (the first sector of a partition containing a filesystem is only used for blocklist embedding, right?).
Grégoire
Quoted 28 lines · Grégoire Sutre
Quoted 8 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 6 lines
Do you know of any OS that would put the superblock in sector 0? I googled a bit, but I couldn't find examples where UFS would not start with a boot sector (afaics, it usually starts with a bootblock area of at least 8KiB -- with OS-specific data in it, e.g. a disklabel).
According to *BSD http://fxr.watson.org/fxr/source/ufs/ffs/fs.h:
Quoted 12 lines
*/"* Depending on the architecture and the media, the superblock may/* */* reside in any one of four places. For tiny media where every block /*
*/* counts, it is placed at the very front of the partition. Historically,/*
*/* UFS1 placed it 8K from the front to leave room for the disk label and/*
*/* a small bootstrap. For UFS2 it got moved to 64K from the front to leave/*
*/* room for the disk label and a bigger bootstrap, and for really piggy/*
*/* systems we check at 256K from the front if the first three fail/*"Interesting. So, when searching for a UFS superblock, sector 0 is a candidate (after sectors 128 and 16). It seems to me that this use of sector 0 for tiny media does not apply to (recent) NetBSD newfs(8), though.
Quoted 5 lines
If we want to improve the situation, we could let the filesystem driver dynamically decide whether the first sector is reserved or not. But I'm not sure that it's worth it (the first sector of a partition containing a filesystem is only used for blocklist embedding, right?).
It's used for putting boot.img into partition. But you're right, it's used mainly for blocklists installs.
Quoted 7 lines
Grégoire
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko