Jump to content











Photo
- - - - -

Creating a ramdisk from command line


  • Please log in to reply
6 replies to this topic

#1 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 10 May 2007 - 09:03 PM

Bilou_Gateux has asked how to create a ramdisk from an ISO file from command line, so here is the command line I've used - maybe Olof can correct if needed.

You can find this question here:
http://www.911cd.net...&...st&p=131441


Command line to create a brand new ramdisk (empty):
imdisk -a -s 10M -m e:

Where:
-a --> attach (add)
-s 10M --> size = 10Mb
-m e: --> mount drive as e:

You still need to format this drive with the filesystem you wish (NTFS, FAT32, etc..)


To unload this drive use:
imdisk -d -m e:

Be sure that the drive isn't being used by another program (like having explorer open on drive e:) so that imdisk can sucessfully lock this volume and then remove it safely.


To mount an ISO image:
imdisk -a -f c:\image.iso -m e:

Where:
-a --> attach
-f c:\image.iso --> image file
-m e: --> mount as drive letter



To further understand the command line of ImDisk I recommend just typing "imdisk" from command line read each one of the options.

You can use these examples to get started and then move on to more parameters as you get familiar with the syntax.

:confused1:

#2 sanbarrow

sanbarrow

    Silver Member

  • Developer
  • 788 posts
  • Location:Germany - Sauerland

Posted 10 May 2007 - 11:49 PM

To replace your regular ramdisk do something like this:

copy imdisk.sys to system32\drivers and

imdisk.cpl
imdisk.exe
imdisk.inf
imdsksvc.exe


to system32.

When your startup script starts, run this instead of ramdisk resizing

rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 132 .\imdisk.inf

imdisk -a -s 200Mb -m r:

format r: /fs:ntfs /v:imdisk /q /y

this creates , mounts and formats a ramdisk of 200 MB to driveletter R:

No need to prepare any registry :confused1:

#3 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 10 May 2007 - 11:50 PM

Bilou_Gateux has asked how to create a ramdisk from an ISO file from command line, so here is the command line I've used - maybe Olof can correct if needed.

...

To unload this drive use:

imdisk -d -u e:


Just a small correction here. You can use either -u devicenumber or -m driveletter: so that should be

imdisk -d -m e:
...or...
imdisk -d -u 0
(The first ImDisk device is number zero.)

To mount an ISO image:

imdisk -a -f c:\image.iso -m e:

Where:
-a --> attach
-f c:\image.iso --> image file
-m e: --> mount as drive letter
To further understand the command line of ImDisk I recommend just typing "imdisk" from command line read each one of the options.


Just like to add an example of RAM-disk based on .iso image file:

imdisk -a -t vm -f c:\image.iso -m e:

-t vm stands for "type: virtual memory"

This creates a RAM-disk that emulates a CD/DVD-ROM drive and loads the contents of c:\image.iso onto it. The virtual disk is then in memory only, the file c:\image.iso is closed directly after it has been read into memory. :confused1:

#4 bilou_gateux

bilou_gateux

    Frequent Member

  • Expert
  • 230 posts
  •  
    France

Posted 11 May 2007 - 12:48 PM

Many thanks Nuno sanbarrow & Olof for your fast answers.

Although i have used the command line imdisk.exe without any switches to view the available switches, my last attempt failed miserabily. Now i have no excuse not to successfully play with the command line tool.

#5 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 12 May 2007 - 11:29 AM

Just a small correction here. You can use either -u devicenumber or -m driveletter: so that should be

imdisk -d -m e:
...or...
imdisk -d -u 0
(The first ImDisk device is number zero.)


Olof, I've tested again and my syntax is still valid - I can use:

imdisk -d -u f:


To sucessfuly unload the drive - try it.. :confused1:

This should probably be corrected or at least make the unload method explain this behavior on the syntax details to become more universal - wouldn't it be a good idea to simplify and use the -u switch to unload either a drive/device number or letter? :confused1:

It's easy to distinguish between these two values (numbers vs letters) and this way only -u switch would be needed.. :confused1:

#6 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 12 May 2007 - 05:23 PM

Olof, I've tested again and my syntax is still valid - I can use:
To sucessfuly unload the drive - try it.. :confused1:


Yes, I see that now but it is just a bug. If you type imdisk -d -u f: it will unload device number 0 and that may not necessarily be the f: drive... :confused1:

I have corrected that now so that it does not accept other than numbers as device numbers just to keep a strict syntax to avoid confusion.

#7 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 12 May 2007 - 05:25 PM

Yes, it is a good idea - I just thought I had written here with a typo myself, I'll also edit first topic to reflect the correct syntax! :confused1:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users