Creating and writing to reserved sectors

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
collisiondetection
Posts: 3
Joined: Wed Mar 30, 2016 6:16 pm

Creating and writing to reserved sectors

Post by collisiondetection »

My operating system is currently just a bootloader (I've spent more time researching and theorizing than actual programming). One thing on my wishlist is a filesystem-independent bootloader.

I am aware that GRUB accomplishes this by keeping a "Stage 1.5" in the reserved area of a disk, but I wonder how it is possible to format a disk (a FAT12 floppy disk, for example) with reserved sectors in which I can place files into.

Does anybody know of a program (or system utility built into some OS I'm not aware of) that can format disks with certain filesystems and with reserved sectors?
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: Creating and writing to reserved sectors

Post by b.zaar »

Grub uses reserved sectors on a partitioned disk. A FAT12 floppy isn't really large enough to include reserved sectors as well as the file system.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: Creating and writing to reserved sectors

Post by mikegonta »

b.zaar wrote:Grub uses reserved sectors on a partitioned disk. A FAT12 floppy isn't really large enough to include reserved sectors as well as the file system.
Those are hidden sectors. You can reserve as many sectors as you want on any FAT file system (as long as you leave some of the available sectors
available for data of course).
Mike Gonta
look and see - many look but few see

https://mikegonta.com
collisiondetection
Posts: 3
Joined: Wed Mar 30, 2016 6:16 pm

Re: Creating and writing to reserved sectors

Post by collisiondetection »

Yes, but how does one accomplish this? I know how GRUB does it - I'm just stumped figuring out how to do it myself.
embryo2
Member
Member
Posts: 397
Joined: Wed Jun 03, 2015 5:03 am

Re: Creating and writing to reserved sectors

Post by embryo2 »

collisiondetection wrote:Yes, but how does one accomplish this? I know how GRUB does it - I'm just stumped figuring out how to do it myself.

Read about FAT format and just write your data accordingly. To write a sector you have BIOS functions. Just use them. You already have a bootloader, then the rest is relatively simple. Or you can write required bytes as a file under your preferred OS and next to copy the file to the beginning of a disk. Under Linux it is the dd program that can help you. Under WindowsXP it is the HxD program. May be there are other programs. Just google for them.
My previous account (embryo) was accidentally deleted, so I have no chance but to use something new. But may be it was a good lesson about software reliability :)
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Creating and writing to reserved sectors

Post by iansjack »

mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: Creating and writing to reserved sectors

Post by mikegonta »

embryo2 wrote:Under Linux it is the dd program that can help you.
The Windows version of DD works on all versions up to and including Windows 7.
embryo2 wrote:Under WindowsXP it is the HxD program.
They are obviously two totally different programs (HxD is not a replacement for DD), however HxD is an excellent disk editor and
works on all versions up to and including Windows 7. Both programs probably also work on Windows 10, however I can not personally verify that.
Mike Gonta
look and see - many look but few see

https://mikegonta.com
User avatar
alexander
Posts: 20
Joined: Wed May 22, 2013 12:02 am
Location: The Netherlands

Re: Creating and writing to reserved sectors

Post by alexander »

mikegonta wrote:
embryo2 wrote:Under Linux it is the dd program that can help you.
The Windows version of DD works on all versions up to and including Windows 7.
embryo2 wrote:Under WindowsXP it is the HxD program.
They are obviously two totally different programs (HxD is not a replacement for DD), however HxD is an excellent disk editor and
works on all versions up to and including Windows 7. Both programs probably also work on Windows 10, however I can not personally verify that.
I can confirm that HxD works flawlessly on Windows 10
mikegonta
Member
Member
Posts: 229
Joined: Thu May 19, 2011 5:13 am
Contact:

Re: Creating and writing to reserved sectors

Post by mikegonta »

alexander wrote:
mikegonta wrote:
embryo2 wrote:Under Linux it is the dd program that can help you.
The Windows version of DD works on all versions up to and including Windows 7.
embryo2 wrote:Under WindowsXP it is the HxD program.
They are obviously two totally different programs (HxD is not a replacement for DD), however HxD is an excellent disk editor and
works on all versions up to and including Windows 7. Both programs probably also work on Windows 10, however I can not personally verify that.
I can confirm that HxD works flawlessly on Windows 10
How about DD for Windows on Win10?
Mike Gonta
look and see - many look but few see

https://mikegonta.com
User avatar
alexander
Posts: 20
Joined: Wed May 22, 2013 12:02 am
Location: The Netherlands

Re: Creating and writing to reserved sectors

Post by alexander »

mikegonta wrote: How about DD for Windows on Win10?
I'll see if I can test that for you.

Edit:I assume you are talking about: http://www.chrysocome.net/dd and not https://sourceforge.net/projects/windd/
Post Reply