SoftPerfect RAM Disk

SSD trim and RAM disk image

Started by mraksoll

SSD trim and RAM disk image   05 May 2020, 21:15

I want to ask about image files. Example: I make an X GB image file, put that image file on a fast SSD.
Question: will SSD trim work with the image? Or will the system be rewriting the same blocks where the image file is stored?
SoftPerfect Support forum - Andrew avatar image

Re: SSD trim and RAM disk image   05 May 2020, 22:51

The image file is a regular file. Upon shutdown or manual saving to the image parts of the file are updated (overwritten). We don't (re)write the entire file, but only the 2 MB blocks that have changed since the image was read or last saved.

As far as I know The TRIM command only applies to file deletions. The OS marks deleted blocks as such and then the TRIM command lets the SSD controller know that the block is free.

What you are asking about is called wear leveling. It's up to the controller whether to move overwritten blocks around or not. From the point of view of the OS, the file stays in the same sectors of the disk, the controller will usually move blocks around to prevent SSD's wear.
SoftPerfect Support forum - Andrew avatar image

Re: SSD trim and RAM disk image   06 May 2020, 22:24

It's worth noting that we have added sparse file support and new images are created as sparse files. This results in much faster image creation, compact disk presentation and faster reading from that image.

We will soon make the new build available. In the meantime, here is what it looks like:

SoftPerfect support forum

Re: SSD trim and RAM disk image   07 May 2020, 00:53

But why size 400 MB when size on disk is 20+ MB? I don't understand.
SoftPerfect Support forum - Andrew avatar image

Re: SSD trim and RAM disk image   07 May 2020, 11:26

It's called a sparse file. Simply put, any empty space inside a sparse file is not stored on the physical disk.

With regards to the RAM Disk, it acts like a dynamic image file that grows and occupies disk space when it's populated. Upon creation most of the image file is filled with zeros and therefore it takes little space regardless of its logical size.

You can download the latest build with sparse file support here.

Re: SSD trim and RAM disk image   07 May 2020, 20:47

Works perfectly!
Does the image self-compact when data was deleted? Or do I need to do it somehow manually?

Tested: no compacting when data deleted and saved to .img. Maybe need a new flag in GUI with autocompacting during mount/unmount or after saving, and manual compacting from the image menu.
SoftPerfect Support forum - Andrew avatar image

Re: SSD trim and RAM disk image   07 May 2020, 21:38

The file is not compacted when data is deleted from a RAM disk or image. In general when you delete a file, the OS marks the space within the file system as unallocated, but it doesn't zero it out. Later that space is reused to write another file in it.

It is technically doable to zero-out free space with a third-party utility and then compress the sparse image file. However this will in turn cause the image file to have multiple "holes" (areas with zeros) and become heavily fragmented.

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 **     **  ********  ********   **    **  **    ** 
  **   **      **     **     **   **  **   ***   ** 
   ** **       **     **     **    ****    ****  ** 
    ***        **     ********      **     ** ** ** 
   ** **       **     **            **     **  **** 
  **   **      **     **            **     **   *** 
 **     **     **     **            **     **    ** 

Message: