Skip to contentSkip to conversation

Scripting - write to HD support?

DISCUSSION Markus Laire 3 participants 5 messages Oct 6, 2006 – Oct 7, 2006

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Marco Gerards

I'm looking forwards to your ideas, questions, suggestions, criticism and bug reports. :-)

Will there be any support for writing data to HD? Even a simple support for writing some data to HD would allow quite a lot of ideas to be implemented in grub which would be impossible with read-only access.

Full support for writing to filesystems is likely far too much to ask.

But what about a possibility to create a certain file in advance (e.g. /boot/grub/mydata filled with e.g. 1MB of zeroes) and then an ability to write to that file without changing the size of the file.

Alternative idea would be to create a partition (without any filesystem) specifically for saving some data from grub, and then grub would just give a read/write access to that partition as a single block of data.

Signature · 1 line
Markus Laire
#1 lore raw
Quoted 8 lines · Markus Laire
Quoted 2 lines · Marco Gerards

I'm looking forwards to your ideas, questions, suggestions, criticism and bug reports. :-)

Will there be any support for writing data to HD? Even a simple support for writing some data to HD would allow quite a lot of ideas to be implemented in grub which would be impossible with read-only access.

The disk support in GRUB 2 supports writing to disk. However, it is not used.

Quoted 1 line

Full support for writing to filesystems is likely far too much to ask.

Right.

Quoted 3 lines

But what about a possibility to create a certain file in advance (e.g. /boot/grub/mydata filled with e.g. 1MB of zeroes) and then an ability to write to that file without changing the size of the file.

Writing zero's reliable. For example, filesystem implementations might change this into a sparse file. Another problem could be reiserfs, which stores metadata and data in the same sectors, IIRC.

So instead of using zero's, we could of course use ones. For reiserfs we would have to look how big the file has to be to make sure metadata won't share this sector.

But still, it is something we have to be extremely careful with. And a more important question is: Why do you want this, do you have specific uses for such feature in mind? I can think of things like fallback, etc.

Quoted 4 lines

Alternative idea would be to create a partition (without any filesystem) specifically for saving some data from grub, and then grub would just give a read/write access to that partition as a single block of data.

I don't like this, it will make it hard or impossible to install GRUB on certain systems.

--
Marco

#2 lore raw
Quoted 10 lines · Marco Gerards
Quoted 8 lines · Markus Laire
Quoted 2 lines · Marco Gerards

I'm looking forwards to your ideas, questions, suggestions, criticism and bug reports. :-)

Will there be any support for writing data to HD? Even a simple support for writing some data to HD would allow quite a lot of ideas to be implemented in grub which would be impossible with read-only access.

I agree this would be a great feature.

Quoted 15 lines

The disk support in GRUB 2 supports writing to disk. However, it is not used.

Quoted 1 line

Full support for writing to filesystems is likely far too much to ask.

Right.

Quoted 3 lines

But what about a possibility to create a certain file in advance (e.g. /boot/grub/mydata filled with e.g. 1MB of zeroes) and then an ability to write to that file without changing the size of the file.

Writing zero's reliable. For example, filesystem implementations might change this into a sparse file. Another problem could be reiserfs, which stores metadata and data in the same sectors, IIRC.

Quoted 8 lines

So instead of using zero's, we could of course use ones. For reiserfs we would have to look how big the file has to be to make sure metadata won't share this sector.

But still, it is something we have to be extremely careful with. And a more important question is: Why do you want this, do you have specific uses for such feature in mind? I can think of things like fallback, etc.

Yeah, we should focus on enabling some specific features.

Quoted 7 lines
Quoted 4 lines

Alternative idea would be to create a partition (without any filesystem) specifically for saving some data from grub, and then grub would just give a read/write access to that partition as a single block of data.

I don't like this, it will make it hard or impossible to install GRUB on certain systems.

I like this; it's nice and simple. It's also similar to the situation with Open Firmware and NVRAM. This approach could extend to NVRAM on other systems as well...

Systems without a free partition just wouldn't be able to take advantage of the feature.

-Hollis

#3 lore raw
In reply to Marco Gerards
Quoted 4 lines · Marco Gerards

But still, it is something we have to be extremely careful with. And a more important question is: Why do you want this, do you have specific uses for such feature in mind? I can think of things like fallback, etc.

Ability to edit the grub-menus and then save the result to HD from within grub would be nice.

This could be done by creating the menus based on the saved data, and then giving the ability to change that data.

Also the ability to edit the actual scripts which generate the menus (and to save that result) would be nice.

Signature · 1 line
Markus Laire
#4 lore raw
In reply to Marco Gerards
Quoted 7 lines · Marco Gerards
Quoted 4 lines

Alternative idea would be to create a partition (without any filesystem) specifically for saving some data from grub, and then grub would just give a read/write access to that partition as a single block of data.

I don't like this, it will make it hard or impossible to install GRUB on certain systems.

Maybe you misunderstood me a bit.
I didn't mean that grub would need to know which partition has this "special" status. Instead grub would give a general read/write access to any partition as a single block of data, and user would then use the partition he wants.

e.g.
# Read 1024 bytes from partition (hd0,3) starting at position 0 data = read (hd0,3), 0, 1024;
# Write new data to that same position
write (hd0,3), 0, newdata;

Signature · 1 line
Markus Laire