[HOWTO] boot from a hard disk image file

Here you can post about non-standard installation methods
(for example when using grub4dos).
Post Reply
crashman
Contributor
Contributor
Posts: 118
Joined: 28 Dec 2010, 17:03
Location: Poland

[HOWTO] boot from a hard disk image file

Post#1 by crashman » 19 Feb 2011, 18:31

Howto install porteus or other live cd/usb to NTFS or linux partition with oryginal bootmenu.

Tested in slax-remix-v08 and porteus-v01-alpha.

If you are working in porteus-v01-alpha, please restart your system with 'max_loop=50' cheatcode before installation.

First step: create a directory called xlive in your favorite partition - in my case, this is NTFS /mnt/sda1/xlive. Create a directory called porteus-v01-alpha in xlive - e.g. '/mnt/sda1/xlive/porteus-v01-alpha'

Download the porteus.iso and extract it using the mount tool.
in console:

Code: Select all

mkdir /mnt/tmp
mount -o loop /patchtoisofile/porteus.iso /mnt/tmp
go to /mnt/tmp directory and copy the porteus directory to /mnt/sda1/xlive/porteus-v01-alpha.
Copy the boot directory to /root
in console:

Code: Select all

umount /mnt/tmp
Download hard disk image (with syslinux 3.85) http://www.mediafire.com/file/oilhql3sg ... img.tar.gz copy to /root directory and unpack:
tar -xvzf hd5M.img.tar.gz.
Rename the file hd5M.img to porteus-alpha.img
In console:

Code: Select all

cd /root
mkdir tmp
mount -o loop,offset=32256 porteus-alpha.img tmp
Go to the /root directory and copy boot directory to tmp, then go to /root/tmp/boot and edit the porteus.cfg file to add the cheatcode parameters:
from_dev=/dev/sda1 from_dir=/xlive/porteus-v01-alpha, For example, this is my porteus.cfg

Code: Select all

LABEL xconf
MENU LABEL Graphics mode (KDE).
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.lz vga=791 splash=silent quiet autoexec=xconf;telinit~4 nomodeset from_dev=/dev/sda1 from_dir=/xlive/porteus-v01-alpha max_loop=50
TEXT HELP
    Run Porteus the best way we can.
    Try to autoconfigure graphics
    card and use the maximum
    allowed resolution
ENDTEXT

LABEL lxde
MENU LABEL Graphics mode (LXDE).
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.lz vga=791 splash=silent quiet autoexec=lxde;xconf;telinit~4 nomodeset from_dev=/dev/sda1 from_dir=/xlive/porteus-v01-alpha max_loop=50
TEXT HELP
    Run Porteus the same as above.
    Lightweight LXDE to be
    launched as default desktop
ENDTEXT

LABEL fresh
MENU LABEL Always Fresh
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.lz autoexec=xconf;telinit~4 nomodeset from_dev=/dev/sda1 from_dir=/xlive/porteus-v01-alpha max_loop=50
TEXT HELP
    Normally Porteus saves all changes
    to the 
    on the boot media (if writable)
    and restores them next boot.
    Use this option to start a fresh
    system, no changes are neither
    read nor written anywhere
ENDTEXT

LABEL cp2ram
MENU LABEL Copy To RAM
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.lz vga=791 splash=silent quiet copy2ram autoexec=xconf;telinit~4 nomodeset from_dev=/dev/sda1 from_dir=/xlive/porteus-v01-alpha max_loop=50
TEXT HELP
    Run Porteus the same as above,
    but first copy all data to RAM
    to get huge speed (needs >300MB)
ENDTEXT

LABEL startx
MENU LABEL Graphics VESA mode
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.lz autoexec=telinit~4 nomodeset from_dev=/dev/sda1 from_dir=/xlive/porteus-v01-alpha max_loop=50
TEXT HELP
    Run Porteus with KDE, but skip
    gfx-card config. Force 1024x768
    using standard VESA driver
ENDTEXT

LABEL text
MENU LABEL Text mode
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd.lz nomodeset from_dev=/dev/sda1 from_dir=/xlive/porteus-v01-alpha max_loop=50
TEXT HELP
    Run Porteus in textmode and start
    command prompt only
ENDTEXT
Save your porteus.cfg and in your console run:

Code: Select all

umount tmp
Now your porteus-alpha.img is ready to boot, first create boot directory in /mnt/sda1/xlive copy this image to /mnt/sda/xlive/boot

How to boot this image ? with grub or Grub4Dos if you are using grub, find your menu.lst and add:

Code: Select all

title Porteus-v01-alpha from NTFS partition
fallback 1
map --mem (hd0,0)/xlive/boot/porteus-alpha.img (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)
map --harddrives=1
boot
if you use only windows XP/vista/2008/7 you can download Grub4Dos here http://sourceforge.net/projects/grub4dos/
extract it and then copy the following to your C:\ directory:
grldr
menu.lst

Then edit your menu.lst. Here is mine:

Code: Select all

# This is a sample menu.lst file. You should make some changes to it.
# The old install method of booting via the stage-files has been removed.
# Please install GRLDR boot strap code to MBR with the bootlace.com
# utility under DOS/Win9x or Linux.

color blue/green yellow/red white/magenta white/magenta
timeout 30
default /default

title Porteus-v01-alpha from NTFS partition
fallback 1
map --mem (hd0,0)/xlive/boot/porteus-alpha.img (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)
map --harddrives=1
boot

title slax-remix-v08 from NTFS partition
fallback 1
map --mem (hd0,0)/xlive/boot/remix-v08.img (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)
map --harddrives=1
boot

title find and load NTLDR of Windows NT/2K/XP
fallback 2
find --set-root --ignore-floppies /ntldr
chainloader /ntldr
savedefault --wait=2

title find and load BOOTMGR of Windows VISTA
fallback 3
find --set-root --ignore-floppies /bootmgr
chainloader /bootmgr
savedefault --wait=2

title find and load CMLDR, the Recovery Console of Windows NT/2K/XP
fallback 4
find --set-root --ignore-floppies /cmldr
chainloader /cmldr
#####################################################################
# write string "cmdcons" to memory 0000:7C03 in 2 steps:
#####################################################################
# step 1. Write 4 chars "cmdc" at 0000:7C03
write 0x7C03 0x63646D63
# step 2. Write 3 chars "ons" and an ending null at 0000:7C07
write 0x7C07 0x00736E6F
savedefault --wait=2

title back to dos
quit

title reboot
reboot

title halt
halt
Last operation if you use windows XP you must edit boot.ini file. Here is mine:

Code: Select all

[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /noexecute=optin /fastdetect
c:\grldr="Start Grub4Dos"
for windows vista/2008/7 look at this excelent solution http://diddy.boot-land.net/grub4dos/fil ... indows.htm

Porteus is now ready to boot from NTFS partition with the original bootmenu. If you want to edit porteus.cfg please use mount tool.

If you want to add another livecd distro you must create another directory in xlive eg. slax-remix-v08 and copy to this directory only the slax folder with all subfolders, and then create slax-remix-v08.img image file for boot. My menu.lst example above shows an entry for slax-remix-v08.

How to create a hard disk image file ?
dd if=/dev/zero of=hd.img bs=1024k count=5
Creates a 5 MB hd.img file for adding syslinux. I use qemu and win98.img floppy image.
Any questions ?
Last edited by crashman on 27 Feb 2011, 20:54, edited 3 times in total.

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: [HOWTO] boot from hard disk image file

Post#2 by Ahau » 19 Feb 2011, 20:26

Great HOWTO, crashman!

Would you mind uploading this to the website? You would need to create a login, and then submit it.

thanks!
Please take a look at our online documentation, here. Suggestions are welcome!

Burninbush
Power user
Power user
Posts: 49
Joined: 29 Dec 2010, 01:46
Location: Near SF, CA

Re: [HOWTO] boot from hard disk image file

Post#3 by Burninbush » 20 Feb 2011, 02:02

Well ... I'm not quite getting this -- how is this method better than a simple frugal install? Just extract /porteus and /boot to a subdir, and setup grub4dos to boot /subdir/boot/vmlinuz + initrd.lz. Unzip a slaxsave.dat file for changes. What is gained by all the fussing with an image file? Why is syslinux needed?

crashman
Contributor
Contributor
Posts: 118
Joined: 28 Dec 2010, 17:03
Location: Poland

Re: [HOWTO] boot from hard disk image file

Post#4 by crashman » 20 Feb 2011, 09:02

@Burninbush
how is this method better than a simple frugal install?
I want original bootmenu with syslinux - start with kde with lxde etc. Easy copy to pendrive and i want use more livecd distros in NTFS partition.
Why is syslinux needed?
syslinux is need for boot hard disk image file, hd5M.img is small only 5 MB for boot only vmlinuz and initrd.lz look in boot directory on porteus and click right mouse button to properties section.

Grub or Grub4Dos emulate hard disk or cd/dvd .iso image file and can boot this.
Why use Grub4Dos in windows ? This is safe method without ingerention in MBR, restore all changes is easy.

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: [HOWTO] boot from hard disk image file

Post#5 by Rava » 27 Feb 2011, 15:48

Since I made an error resizing the current notebook's internal harddisk, this technique is tempting.

But I ran Porteus 1.0 alpha and it seems it has at least one bug that the old Slax Remix (V08 or V09) also had: running LXDE there was one icon from the quickstart icons (at the panel, just right besides the menu on the very left side of the panel) that just is white with a red X and cannot be executed.
Now, when using this technique, I cannot just use the Porteus 1.0 alpha image and still have a rootcopy thingy for lopading fixes, right?
Since usually I don't use the save options with the save file but write the changes I want to keep by hand into the /rootcopy folder.


But my main question is: I use grub4dos, which was a bit of a pain in the backside to get running smoothly with Windows 7 64 bit that was preinstalled on that notebook.
That means I do have a menu.lst already. Now I need to check what I need to alter from your tut so that I can run the .img from Porteus 1.0 alpha 64 bit using that menu.lst...
Cheers!
Yours Rava

crashman
Contributor
Contributor
Posts: 118
Joined: 28 Dec 2010, 17:03
Location: Poland

Re: [HOWTO] boot from hard disk image file

Post#6 by crashman » 27 Feb 2011, 20:53

@ Rava
running LXDE there was one icon from the quickstart icons (at the panel, just right besides the menu on the very left side of the panel) that just is white with a red X and cannot be executed.
Please check for missing or corrupt modules may be firefox.lzm ?
Now, when using this technique, I cannot just use the Porteus 1.0 alpha image and still have a rootcopy thingy for lopading fixes, right?
rootcopy technique normal work in this method no have problems.
Now I need to check what I need to alter from your tut so that I can run the .img from Porteus 1.0 alpha 64 bit using that menu.lst...
E.g. for c:\porteus (in porteus directory is \base \modules \optional etc.)
add to menu.lst

Code: Select all

title Porteus-v01-alpha from NTFS partition
fallback 1
map --mem (hd0,0)/boot/porteus-alpha.img (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)
map --harddrives=1
boot
Remember in /boot folder must be 'porteus-alpha.img'
Please check your directory structure in C:\ partition and put to forum.

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: [HOWTO] boot from a hard disk image file

Post#7 by Rava » 10 Mar 2011, 21:00

So far I installed Porteus 1.0 alpha the usual way by creating boot and porteus folders.
just the rootcopy technique makes me unsure.

Part of the readme from the iso says I can use that also in NTFS due to the overlay, while at another place it is said due to that same overlay FS corruption is possible...

But so far it not works anyway, X doesn't start. viewtopic.php?f=53&t=348&start=20#p1951
Cheers!
Yours Rava

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: [HOWTO] boot from a hard disk image file

Post#8 by Ahau » 10 Mar 2011, 21:16

The porteus .xzm files (or in this case, hard disk image) can stay on an NTFS partition without risking corruption. The problem with NTFS and FAT is saving system changes directly to a windows filesystem, through 'changes=' cheatcode. This process uses posixovl (in version 0.9--it has been removed entirely from v1). If you use a save.dat container (now the default) your files should not have corruption issues. I'll update the install guide for version 1 (final) to clarify.

Rootcopy does not use posixovl, so corruption is not an issue. However, permissions and symlinks are not preserved.
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: [HOWTO] boot from a hard disk image file

Post#9 by Rava » 10 Mar 2011, 21:35

Ahau wrote:Rootcopy does not use posixvol, so corruption is not an issue. However, permissions and symlinks are not preserved.
Symlinks are possible with Windows 7 NTFS, I made a symlink from Boot to boot since I did not want yet another folder in the root of sda2...

But you are right, every file including system files read and writeable for the standard user is not great.
Cheers!
Yours Rava

Post Reply