Jump to content











Photo
- - - - -

Easy creating new empty .IMG

imdisk img gzip

  • Please log in to reply
22 replies to this topic

#1 Divetoxx

Divetoxx

    Newbie

  • Members
  • 18 posts
  • Interests:Assembler, fractals, buddhism
  •  
    Belarus

Posted 04 December 2011 - 03:08 PM

I am glad to introduce my simpliest util. It creates new blank (filled by zeros) hdd image files (with MBR) of any given size.
Then You can mount .img with imdisk and then format it as fat32 or ntfs. Then You can copy files to it and unmount it.
If the resulting image still has some free space, this space can be gzipped wery well because it is repeated zeros.
Nice progressbar :)
Util was written in pure assembler (http://<span style=...ler.net</span>/).

I
SplImgCreator 1.1
Last Updated Mar 11 2012 09:04 PM


#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 December 2011 - 03:55 PM

Nice. :thumbup:

Maybe giving some more info might be of use.
  • The image assumes a disk geometry of n/255/63
  • Toggling the FAT32/NTFS results in partition ID of (respectively) 0C (FAT32 LBA mapped) and 07 (NTFS).
  • The disk signature is written (and it is fixed to 88888888)
  • No MBR code is written, ONLY the Disk signature, the partition table and the magic bytes 55AA.
  • The "size" is IGNORED for anything below 8,225,280 (1x255x63x512=8,225,280)

Issues? or Features?:
  • If you input a size of 10,000 Kilobytes, the resulting image will be nonetheless 8,225,280 bytes :w00t:
  • If you input a size of 100,000 Kilobytes, the resulting image will be 98,703,360 :w00t:

In other words, your input is rounded down to nearest multiple of 8,225,280, i.e. a multiple of a cylinder with 255 heads and 63 sectors.

:cheers:
Wonko

#3 Vortex

Vortex

    Frequent Member

  • Advanced user
  • 299 posts

Posted 04 December 2011 - 06:07 PM

Hi Divetoxx,

Perhaps, you should explain us what is "pure assembler"

#4 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 04 December 2011 - 08:06 PM

That is machine code.

Some Ice-Aged programmers used it to write functions which
  • Run fast
  • Need only some memory to run.
Nowadays speed is no problem. The actual CPUs run several thousand times faster then the first x86 CPUs. Nowadays also the cheapest PC has memory which is about one million multiply compared to the Ice-Age.

But it is still valid that assembly code is much faster.

@Divetoxx: Cogratulations! :1st:

Peter

#5 Tokener

Tokener

    Frequent Member

  • Developer
  • 378 posts

Posted 04 December 2011 - 08:45 PM

Hi Divetoxx
Thanks a lot for sharing Your useful tool.
Best wishes T.

#6 Divetoxx

Divetoxx

    Newbie

  • Members
  • 18 posts
  • Interests:Assembler, fractals, buddhism
  •  
    Belarus

Posted 04 December 2011 - 10:32 PM

Maybe giving some more info might be of use.

Yes, You are right! These are features which I coded :)
And let me say a few words about no MBR code is written. I prefer to use my .img with grub4dos this way:
title Windows 7 RAMDISK

find --set-root /my7.img.gz

map --mem-min=4G

map --mem /my7.img.gz (hd0)

map --hook

root (hd0,0)

chainloader /bootmgr

This is my menu.lst code. "chainloader /bootmgr" works great without any MBR and BR code! But If I will use my.img as boot HDD in virtualbox, for example, I will write real MBR and BR codes. I have found very nice utility named "BOOTICE" written by Pauly (If I am not mistaken, He is a Chinese programmist and He isn't speak English.) BOOTICE can write MBR and BR directly to .img file! It's great!

In other words, your input is rounded down to nearest multiple of 8,225,280, i.e. a multiple of a cylinder with 255 heads and 63 sectors.

Yes! I don't know what can I do with user input smaller than 1 cylinder... So I round it.
I know that Microsoft forgot this geometry and now consider 1 cylinder has 1 head and 2048 sectors, :) but It's not important for RAM disks - we don't need an alignment of RAM partitions!

#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 December 2011 - 09:42 AM

Yes! I don't know what can I do with user input smaller than 1 cylinder... So I round it.
I know that Microsoft forgot this geometry and now consider 1 cylinder has 1 head and 2048 sectors, :) but It's not important for RAM disks - we don't need an alignment of RAM partitions!

This statement needs a small correction.
The CHS geometry is a "legacy" set of values that have no real meaning since a few years, when LBA became largely used.
Due to a number of reasons which include compatibility with older OS and some lazyness from MS programmers, they still need to be valid for some configurations to work.
The 2048 is NOT 2048x1, but rather CHS 0/33/32 on a c/h/63 geometry, as (33-1)*63+32=2048.
No hard disk has actually a "geometry" that is "accessible" byt the OS, it is in any case a "virtual" geometry set in firmware or, if you prefer a "translated" geometry from the "real" (UNknown) internal one to the "standard" n/255/63.
The new 2048 alignment is IMNSHO a meaningless choice, see here for some reference:
http://reboot.pro/9897/
http://reboot.pro/9897/page__st__4

An alignment on a multiple of 4kb (8x512 bytes sectors) is needed on the new 4 Kb sector hard disks, some have a jumper to add a virtual sector so that legacy tool can start on an offset of 64 instead of 63.

If the scope is using the image with any pre-Vista :ph34r: OS or as RAM disk, there is NO problem whatsoever with using the n/255/63 geometry. :thumbsup:

:cheers:
Wonko

#8 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 05 December 2011 - 10:23 AM

In what way is this different from qemu-img.exe which can create many different formats of VHD (except it is command line program).
Is there a utility that will create a formatted VHD in one go?

#9 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 December 2011 - 10:34 AM

In what way is this different from qemu-img.exe which can create many different formats of VHD (except it is command line program).

I HOPE that by "VHD" you mean a Virtual Hard Disk image and NOT a "VHD" (which is the Connectix/Microsoft format). :ph34r:
Please to avoid confusion do not use "VHD" for anything but the specific format :).

Is there a utility that will create a formatted VHD in one go?

If you mean a formatted RAW image, you can use my half @ssed batch Mbrbatch/mkimg under 32 bit :
http://reboot.pro/3191/

qemu-img creates "empty" images, there is No partition tables in them.
It basically creates a 00 filled file (in the case of non-RAW formats like VMDK/VHD it adds the header/footer etc., but NO data inside the actual image).

Clonedisk is "better" in this respect since it is GUI:
http://reboot.pro/8480/

:cheers:
Wonko

#10 Divetoxx

Divetoxx

    Newbie

  • Members
  • 18 posts
  • Interests:Assembler, fractals, buddhism
  •  
    Belarus

Posted 06 December 2011 - 08:18 PM

An alignment on a multiple of 4kb (8x512 bytes sectors) is needed on the new 4 Kb sector hard disks

...and for all SSD and flash disks too, because it drastically speeds up r/w operations. I'm using .img file as RAM disk, so the first partition starts at 63 sector, not 2048 :)

That is machine code.
Some Ice-Aged programmers used it to write functions which
Run fast
Need only some memory to run.

Machine code is something like that: B8 01 02
Assembler code is something like this: mov ax, 0201
It looks like a language :)
Greatest assembler feature is full contol over all that your program doing.
Using high-level languages You build Your programs from bricks, using low-level (assembler) You build even not from grain of sand but from atoms.

Perhaps, you should explain us what is "pure assembler"

"Pure" means not assembler fragments in C++ or Delphi, but whole source written in assembler language and compiled using assembler compiler such as TASM, MASM, NASM or FASM.
I prefer Flat Assembler due to it is new, modern and very easy-to-use compiler. You only need two files: first, the fasm.exe and second, your.asm source code, that's all! Result is your.exe executable file which may be windows GUI application.

In what way is this different from qemu-img.exe which can create many different formats of VHD (except it is command line program).

I am sorry, I still haven't found good manuals explaining VHD format. I know one difference between a fixed VHD and an image of HDD partition is the last 512-bytes sector of VHD with special structure. Can anybody tell me about this structure format?
So my util produces only an image of one HDD partition (with MBR before, as it is on real HDD).
I am not sure it is possible to mount VHD with imdisk...

Edited by Divetoxx, 06 December 2011 - 08:29 PM.


#11 Vortex

Vortex

    Frequent Member

  • Advanced user
  • 299 posts

Posted 06 December 2011 - 08:51 PM

"Pure" means not assembler fragments in C++ or Delphi, but whole source written in assembler language and compiled using assembler compiler such as TASM, MASM, NASM or FASM.


Yes, moving the whole assembly code to a separate module instead of using inline assembly ( like asm fragments in high-level languages ) is preferable. I agree with you. Fasm is another good choice. Unfortunately, with pure assembly some other people mean assembly code stripped of high-level constructs. Modern assembly gains efficiency with HLL elements.

#12 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 06 December 2011 - 11:06 PM

...and for all SSD and flash disks too, because it drastically speeds up r/w operations. I'm using .img file as RAM disk, so the first partition starts at 63 sector, not 2048

But for different reasons, and BTW, and JFYI, it applies to NTFS and NOT necessarily to other filesystems:
http://www.msfn.org/...n-its-clusters/

I am sorry, I still haven't found good manuals explaining VHD format. I know one difference between a fixed VHD and an image of HDD partition is the last 512-bytes sector of VHD with special structure. Can anybody tell me about this structure format?
So my util produces only an image of one HDD partition (with MBR before, as it is on real HDD).
I am not sure it is possible to mount VHD with imdisk...

Sure :).
Just like you can with grub4dos, last sector (footer) is simply ignored (we are talking ONLY of FIXED size VHD's).
The footer format is quite plain, our in-house utility Clonedisk has this feature, but the format is well documented:
http://www.mcgrane.c...-VHD-Files.aspx
http://jim.studt.net...es-or-even-vmdk

There is also the small tool by karyonix, here (which includes C source):
http://reboot.pro/9715/

From the mouth of the wolf:
http://technet.micro...y/bb676673.aspx

:cheers:
Wonko

#13 Divetoxx

Divetoxx

    Newbie

  • Members
  • 18 posts
  • Interests:Assembler, fractals, buddhism
  •  
    Belarus

Posted 07 December 2011 - 10:24 PM

I am planning to add VHD creation in my util. And I have very interesting question: Is it possible to boot Windows 7 from fixed-size VHD which placed on the partition formatted as NTFS with non-standard cluster size 32 Kb? My experiment finished unsuccessfully :(

#14 Divetoxx

Divetoxx

    Newbie

  • Members
  • 18 posts
  • Interests:Assembler, fractals, buddhism
  •  
    Belarus

Posted 11 March 2012 - 08:12 PM

New bugfixed version, bug was - lost bit - cylinder 9th bit (sector 7th bit) in CHS

#15 TheHive

TheHive

    Platinum Member

  • .script developer
  • 4199 posts

Posted 12 March 2012 - 08:04 AM

Guess I missed it first time around. Thanks!

Questions>
Any success with VHD Creation?

Can you make it easier to input a size. For Example
Type in a number in also MB,GB, TB. It could be a drop down menu or something on the right side.

#16 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 12 March 2012 - 08:39 AM

Some Q's
1. What will image file be called?
2. What folder will it be in?
3. I run app in Win 7 64-bit OS and set size of 340000 NTFS - and click Create - nothing seems to happen?

#17 Divetoxx

Divetoxx

    Newbie

  • Members
  • 18 posts
  • Interests:Assembler, fractals, buddhism
  •  
    Belarus

Posted 12 March 2012 - 07:42 PM

Any success with VHD Creation?

I am sorry :( Still no success because of my busyness :(

Can you make it easier to input a size.

I am planning it... For example, I think about input in "cylinders"...

#18 Divetoxx

Divetoxx

    Newbie

  • Members
  • 18 posts
  • Interests:Assembler, fractals, buddhism
  •  
    Belarus

Posted 12 March 2012 - 07:50 PM

1. What will image file be called? 2. What folder will it be in? 3. I run app in Win 7 64-bit OS and set size of 340000 NTFS - and click Create - nothing seems to happen?

Oh, thank You very much! I didn't test it in 64-bit OS'es and I'm sad... Is it possible that Win 7 64-bit doesn't support Win32 API? Or may be some functions have additional parameters or security descriptors... I will test and debug my util in 64-bit Win. The save file dialog (with name and path fields) should appear after pressing the button "Create"...

Edited by Divetoxx, 12 March 2012 - 07:51 PM.


#19 betrand

betrand

    Frequent Member

  • Advanced user
  • 467 posts
  •  
    France

Posted 05 May 2012 - 07:47 PM

Hi Divetoxx,
I like your tool, but I can never find it.
So I'll add my own keywords ;), for future ref.
"easily create image tool"
easily make image diskimage tool.
Simple. I can never remember "simple". :dubbio:

Cheers.
r.

#20 davidm71

davidm71
  • Members
  • 5 posts
  •  
    United States

Posted 12 March 2018 - 08:51 PM

Was wondering if there can be FAT12 support?? I am trying to figure out how to make an image I can flash to my rom to be loaded as an emulated drive and I believe it has to be FAT12?

 

Thanks



#21 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 12 March 2018 - 09:06 PM

Was wondering if there can be FAT12 support?? I am trying to figure out how to make an image I can flash to my rom to be loaded as an emulated drive and I believe it has to be FAT12?

 

Thanks

Hey, weren't you looking at the mtools yesterday?

 

Why don't you start a new thread specifying what you need/want to do, so that people can help you?

 

With all due respect :) , you seem like being in a X/Y/Z problem:

 

 

:duff:

Wonko



#22 davidm71

davidm71
  • Members
  • 5 posts
  •  
    United States

Posted 12 March 2018 - 09:42 PM

Yes. More like an ABCDEFG problem!

Will start my own thread..

Thanks

#23 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 13 March 2018 - 10:38 AM

Yes. More like an ABCDEFG problem!

No, I really meant a X/Y/Z problem, JFYI ;):

https://perl.plover....Questions3.html

 

:duff:

Wonko






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users