grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* Reserved first sector for UFS
@ 2011-01-07  9:35 Grégoire Sutre
  2011-01-07 10:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 8+ messages in thread
From: Grégoire Sutre @ 2011-01-07  9:35 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 69 bytes --]

Isn't the first sector reserved for the boot block in UFS?

Grégoire

[-- Attachment #2: grub-ufs.diff --]
[-- Type: text/plain, Size: 342 bytes --]

=== modified file 'grub-core/fs/ufs.c'
--- grub-core/fs/ufs.c	2010-10-16 20:16:52 +0000
+++ grub-core/fs/ufs.c	2011-01-07 09:31:49 +0000
@@ -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
   };
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reserved first sector for UFS
  2011-01-07  9:35 Reserved first sector for UFS Grégoire Sutre
@ 2011-01-07 10:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-01-07 10:48   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-01-07 11:23   ` Grégoire Sutre
  0 siblings, 2 replies; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-01-07 10:30 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On 01/07/2011 10:35 AM, Grégoire Sutre wrote:
> 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 };


> Grégoire
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reserved first sector for UFS
  2011-01-07 10:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-01-07 10:48   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-01-07 10:57     ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-01-07 11:23   ` Grégoire Sutre
  1 sibling, 1 reply; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-01-07 10:48 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 739 bytes --]

On 01/07/2011 11:30 AM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 01/07/2011 10:35 AM, Grégoire Sutre wrote:
>   
>> 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
>> Grégoire
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>   
>>     
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reserved first sector for UFS
  2011-01-07 10:48   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-01-07 10:57     ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-01-07 10:57 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

On 01/07/2011 11:48 AM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 01/07/2011 11:30 AM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>   
>> On 01/07/2011 10:35 AM, Grégoire Sutre wrote:
>>   
>>     
>>> 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
>   
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
>>> Grégoire
>>>
>>>
>>> _______________________________________________
>>> Grub-devel mailing list
>>> Grub-devel@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>>   
>>>     
>>>       
>>   
>>     
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reserved first sector for UFS
  2011-01-07 10:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-01-07 10:48   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-01-07 11:23   ` Grégoire Sutre
  2011-01-07 12:20     ` Vladimir 'φ-coder/phcoder' Serbinenko
  1 sibling, 1 reply; 8+ messages in thread
From: Grégoire Sutre @ 2011-01-07 11:23 UTC (permalink / raw)
  To: The development of GNU GRUB

On 01/07/2011 11:30, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 01/07/2011 10:35 AM, Grégoire Sutre wrote:
>> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reserved first sector for UFS
  2011-01-07 11:23   ` Grégoire Sutre
@ 2011-01-07 12:20     ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-01-07 14:18       ` Grégoire Sutre
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-01-07 12:20 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]

On 01/07/2011 12:23 PM, Grégoire Sutre wrote:
> On 01/07/2011 11:30, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>> On 01/07/2011 10:35 AM, Grégoire Sutre wrote:
>>> 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).
>
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/*"

> Grégoire
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reserved first sector for UFS
  2011-01-07 12:20     ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-01-07 14:18       ` Grégoire Sutre
  2011-01-07 16:39         ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 8+ messages in thread
From: Grégoire Sutre @ 2011-01-07 14:18 UTC (permalink / raw)
  To: The development of GNU GRUB

On 01/07/2011 13:20, Vladimir 'φ-coder/phcoder' Serbinenko wrote:

>> 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/*"

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reserved first sector for UFS
  2011-01-07 14:18       ` Grégoire Sutre
@ 2011-01-07 16:39         ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-01-07 16:39 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1936 bytes --]

On 01/07/2011 03:18 PM, Grégoire Sutre wrote:
> On 01/07/2011 13:20, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>
>>> 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/*"
>
> 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?).
>
It's used for putting boot.img into partition. But you're right, it's
used mainly for blocklists installs.
> Grégoire
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-01-07 17:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-07  9:35 Reserved first sector for UFS Grégoire Sutre
2011-01-07 10:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-01-07 10:48   ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-01-07 10:57     ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-01-07 11:23   ` Grégoire Sutre
2011-01-07 12:20     ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-01-07 14:18       ` Grégoire Sutre
2011-01-07 16:39         ` Vladimir 'φ-coder/phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).