Is it possible to run any distro from RAM from within an .iso saved on an NTFS file system?

5,253

There's an EXE installer for Puppy Linux which boots from an .iso on FAT32, NTFS or Linux filesystems (i.e. ext2/ext3/ext4, xfs, etc.) using syslinux and runs in RAM using unionfs/aufs with full access to persistent storage (disk, SD, flashdrive, etc.).

Other ISOs can be mounted, from commandline or script of course, as well as by clicking on them in the included ROX-Filer file manager. One convenient use of this is to selectively access or restore files from an old version instead of having to roll back everything.

The original Puppy Linux distribution ISO, which itself is an usually an ext3/4 filesystem, is kept on the lowest layer of the aufs stack. Changes are recorded in the topmost layer and flushed to disk periodically (configurable) to a "savefile". On boot, the original ISO is loaded to RAM and mounted read-only, then the savefile is loaded and mounted read-only to overlay it and an empty read-write layer mounted for any new changes. To preserve a history of changes, just setup automatic or manual coping of the savefile ISO to an archival directory.

The O/S "layering" of unionfs/aufs along with multi-mounting of filesystems are the core technologies at work here, so if Puppy Linux doesn't work for you, look for other distros using them.

There are quite a number of installation options available for Puppy Linux including a Windows EXE Installer which is a separate package that sets up the Windows boot loader for dual-boot.

Share:
5,253
Ehryk
Author by

Ehryk

I'm a Computer (Web) Programmer/Analyst based in Anchorage, AK and Minneapolis, MN. I use (among other things) ASP.NET, C# and SQL Server. I build things. Bicycles, computers, websites, guitars, cars, motorcycles, sound sytems... lots of things. Resume: http://ericmenze.com Personal Website: http://ehryk.com Pause your videos at specific locations: http://pauseforlater.com Calculate and build spoked bicycle wheels: http://wheelspoking.com See activity specific analysis of your GPX Files: http://gpxdataanalyzer.com Tool to open command/powershell prompts from any location (Windows): https://github.com/Ehryk/ContextMenuTools

Updated on September 18, 2022

Comments

  • Ehryk
    Ehryk over 1 year

    Running entirely from RAM been done on various distros such as Slax, DamnSmallLinux, and newer Ubuntu versions, and since I have 8GB it seems reasonable that I could run many distros entirely from RAM (as long as I select one that has the ability).

    I would like to do this with OpenELEC (or any distro), and with a further complication: I'm a .NET developer, work and primarily use Windows, which means NTFS and FAT32 are my preferred file systems. Until the day comes if and when Windows can natively read/write ext partitions, this won't change. Ext2fck won't even install in Windows 8, so there's no convincing me of the 'merits' of having drives and partitions in an unreadable format to my daily operation.

    There's also things like syslinux, vmlinuz, extlinux and the like that can load .iso files into RAM and effectively bootload them. To add icing on the cake, Windows' bootloader will allow me to add these as options in the native Windows boot menu, which I have done for UBCD 5.11, and will even work for virtual file systems like .vhd, etc.

    So, here's my dream:

    I want to combine all three into one. I want to take an installed ext2/ext3/ext4 partition, in this case an install of OpenELEC, compress it into an .iso, and create an entry in my boot menu that will either do this directly, or pass it to syslinux or the like that will do the following:

    Extract the .iso completely into RAM as an ext2/3/4 partition and boot into that OS in RAM. I'll then mount my NTFS hard drive for the /STORAGE portion of the OpenELEC install with ntfs-3g.

    Then, as a bonus, on exit I'd have the system recompress itself to an .iso, and if successful replace the initial .iso thereby persisting my changes across boots (provided the shutdown was successful). It wouldn't have to copy itself from memory, either: it could copy any files/changes it wanted to track (if some were not available) back onto the drive it booted from, if present, then compress that back into an .iso.

    Slax, DSL and Ubuntu can boot to RAM and persist changes, so I know it's possible if your OS supports it. I'm wondering if this can be made into a 'works for any distro you want'. Slax saves your changes in an ext directory /slax/changes if it's on an ext partition, or as changes.dat otherwise (for NTFS/FAT32). This solution could work too, I suppose, but would probably require more interaction with the hosted OS to coordinate this than using the .iso.

    So, how close can I get?

    Are there easy solutions for this already out there? Would I have to write a custom 'SYSLINUX'/'ISOLINUX'/'EXTLINUX'/'VMLINUX? What would be required to make this happen, and if it's possible already how do I get started?

    • Amitav Pajni
      Amitav Pajni over 11 years
      Have you ever heard of virtualization? (And how do you get along with only 8GB of RAM?)
    • Ehryk
      Ehryk over 11 years
      I'm not interested in virtualizing a media center distro, and the purpose of the distro I have on the other partition (Slax) is to perform operations on the main partition that require it to be unmounted, such as gparted and provide a quick, lightweight system. (and 8GB is plenty for a laptop)
    • sunnysideup
      sunnysideup over 11 years
      You would have to customize the initramfs of your target distribution as you mount the root filesystem from the initramfs. debian-live based live distributions for example should already support loading the file system into memory, i don't know about other live systems.
    • Ehryk
      Ehryk over 11 years
      I want to interject BEFORE then: boot to SYSLINUX or similar. SYSLINUX would then take an .iso saved on the NTFS/FAT32 drive, which would extract the .iso into memory as an ext2/3/4 file system that houses the distro, then pass control to it. By the time it's gotten to mounting from 'initramfs`, I think it'd already be complaining about not being on an ext2/3/4 partition, correct?
    • frostschutz
      frostschutz over 11 years
      You can do anything you want in initramfs. See for example en.gentoo-wiki.com/wiki/Initramfs -- you still need a bootloader capable of loading kernel+initrd in the first place, and very good knowledge about Linux to create an initramfs that actually does what you want it to do. Your ISO approach to things is cumbersome to say the least. I'd rather create a Linux partition, and if you really need read access to files from Windows, rsync them over on shutdown. That'd be a simple init script.
    • Ehryk
      Ehryk over 11 years
      Could you post some examples or links to get me started as an answer? I'm using a space-critical SSD, so I can't waste 'extra space' on a partition that Windows can't access (specifically space for the file system to grow). Making an ext2/3/4 partition on my SSD is not a desirable option for me, and I'm looking for a way around it.
    • Ehryk
      Ehryk over 11 years
      Am I able to switch kernels without a reboot? Something like: Bootload my custom kernel that initramfses an ext partition into memory, then transfer full control to the kernel in the ext partition as if it had been there from the start?
    • frostschutz
      frostschutz over 11 years
      You can exec kernels, but technically that's like a reboot, ie. the new kernel won't know about the filesystem in memory. You could try Puppy Linux... it can save its state to a file, I'm just not sure if it can save to NTFS or not. Alternatively just get an USB stick or something.
    • Ehryk
      Ehryk over 11 years
      I have used Puppy Linux, and Slax. Slax will save back to NTFS and FAT32. I'm asking if this is possible with any distro I choose; to create an ext partition in RAM and then transfer control, because I want to do this with OpenELEC which does NOT have this feature.