Difference between revisions of "FreeBSD disk image creation"

From Syslinux Wiki
Jump to: navigation, search
(the raw posting from Pascal vandePutte)
 
(markup added)
Line 1: Line 1:
How to create a PXE-bootable disk image of the FreeBSD "bootonly" install ISO
+
= How to create a PXE-bootable disk image of the FreeBSD "bootonly" install ISO =
  
 
Based on an e-mail by Shaun Reitan on the SYSLINUX mailing list in October 2005.
 
Based on an e-mail by Shaun Reitan on the SYSLINUX mailing list in October 2005.
Line 5: Line 5:
  
  
The general idea:
+
== The general idea: ==
  
- transform the small "bootonly" ISO (which is intended to fetch all OS
+
* transform the small "bootonly" ISO (which is intended to fetch all OS files over the network) into a PXE-bootable harddisk image
files
+
* make the first installation CD available on the network e.g. through NFS
  over the network) into a PXE-bootable harddisk image
+
- make the first installation CD available on the network e.g. through NFS
+
  
This howto only explains how to create the PXE-bootable image.
+
== This howto only explains how to create the PXE-bootable image. ==
  
  
- Download the "bootonly" installation ISO (about 25MB for FreeBSD 6.2)
+
* Download the "bootonly" installation ISO (about 25MB for FreeBSD 6.2)
  e.g. ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.2/6.2-RELEASE-i386-bootonly.iso
+
e.g. ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.2/6.2-RELEASE-i386-bootonly.iso
  
- If case you haven't got a FreeBSD system running already, install BSD
+
* If case you haven't got a FreeBSD system running already, install BSD somewhere temporarily using the first installation ISO (e.g. in VMWare).
  somewhere temporarily using the first installation ISO (e.g. in VMWare).
+
  
- Copy the "bootonly" ISO to your BSD system, e.g. using scp or WinSCP.
+
* Copy the "bootonly" ISO to your BSD system, e.g. using scp or WinSCP.
  
- Find out how large you need to create your disk image:
+
* Find out how large you need to create your disk image:
  
 
     # ls -al *.iso
 
     # ls -al *.iso
 
     -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
 
     -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
  
- Create a file of the appropriate size (make it a little larger to account
+
* Create a file of the appropriate size (make it a little larger to account for differences in block size, file system overhead etc.):
  for differences in block size, file system overhead etc.):
+
  
 
     # dd if=/dev/zero of=6.2-RELEASE-i386-bootonly.img bs=1k count=26000
 
     # dd if=/dev/zero of=6.2-RELEASE-i386-bootonly.img bs=1k count=26000
Line 40: Line 36:
 
     -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
 
     -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
  
- Attach this image file as a memory disk:
+
* Attach this image file as a memory disk:
  
 
     # mdconfig -a -t vnode -f 6.2-RELEASE-i386-bootonly.img -u 0
 
     # mdconfig -a -t vnode -f 6.2-RELEASE-i386-bootonly.img -u 0
  
- Write a BSD label with boot code to it:
+
* Write a BSD label with boot code to it:
  
 
     # bsdlabel -w -B md0 auto
 
     # bsdlabel -w -B md0 auto
  
- And create a filesystem on it (BSD uses ufs):
+
* And create a filesystem on it (BSD uses ufs):
  
 
     # newfs -m 0 md0a
 
     # newfs -m 0 md0a
Line 57: Line 53:
 
     160, 13184, 26208, 39232
 
     160, 13184, 26208, 39232
  
- Create a mount point and mount this "memory disk" device (attached to the
+
* Create a mount point and mount this "memory disk" device (attached to the image file):
  image file):
+
  
 
     # mkdir /tmp/img
 
     # mkdir /tmp/img
Line 66: Line 61:
 
     /dev/md0a      24950    4 24946    0%    /tmp/img
 
     /dev/md0a      24950    4 24946    0%    /tmp/img
  
- Create another mount point and mount the ISO file on it through another md
+
* Create another mount point and mount the ISO file on it through another md device:
  device:
+
  
 
     # mkdir /tmp/iso
 
     # mkdir /tmp/iso
Line 76: Line 70:
 
     /dev/md1      24848 24848    0  100%    /tmp/iso
 
     /dev/md1      24848 24848    0  100%    /tmp/iso
  
- Copy the ISO contents to the new disk image file:
+
* Copy the ISO contents to the new disk image file:
  
 
     # cd /tmp/img/
 
     # cd /tmp/img/
Line 89: Line 83:
 
     -r--r--r--  1 root  wheel      25 Apr 27 03:40 cdrom.inf
 
     -r--r--r--  1 root  wheel      25 Apr 27 03:40 cdrom.inf
  
- Unmount and detach all md devices:
+
* Unmount and detach all md devices:
  
 
     # cd
 
     # cd
Line 96: Line 90:
 
     # mdconfig -d -u 1
 
     # mdconfig -d -u 1
  
- We're done. Copy the .img file to your tftp server.
+
* We're done. Copy the .img file to your tftp server.
  
 
     # ls -al *.img *.iso
 
     # ls -al *.img *.iso
Line 102: Line 96:
 
     -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
 
     -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
  
- And add something similar to this to your pxelinux.cfg/default file:
+
* And add something similar to this to your pxelinux.cfg/default file:
  
 
     label freebsd62
 
     label freebsd62
 
         kernel memdisk
 
         kernel memdisk
 
         append initrd=images/freebsd/6.2-RELEASE-i386-bootonly.img harddisk
 
         append initrd=images/freebsd/6.2-RELEASE-i386-bootonly.img harddisk

Revision as of 20:09, 2 May 2007

How to create a PXE-bootable disk image of the FreeBSD "bootonly" install ISO

Based on an e-mail by Shaun Reitan on the SYSLINUX mailing list in October 2005. http://syslinux.zytor.com/archives/2005-October/006076.html


The general idea:

  • transform the small "bootonly" ISO (which is intended to fetch all OS files over the network) into a PXE-bootable harddisk image
  • make the first installation CD available on the network e.g. through NFS

This howto only explains how to create the PXE-bootable image.

  • Download the "bootonly" installation ISO (about 25MB for FreeBSD 6.2)

e.g. ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.2/6.2-RELEASE-i386-bootonly.iso

  • If case you haven't got a FreeBSD system running already, install BSD somewhere temporarily using the first installation ISO (e.g. in VMWare).
  • Copy the "bootonly" ISO to your BSD system, e.g. using scp or WinSCP.
  • Find out how large you need to create your disk image:
   # ls -al *.iso
   -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
  • Create a file of the appropriate size (make it a little larger to account for differences in block size, file system overhead etc.):
   # dd if=/dev/zero of=6.2-RELEASE-i386-bootonly.img bs=1k count=26000
   26000+0 records in
   26000+0 records out
   26624000 bytes transferred in 1.404435 secs (18957091 bytes/sec)
   # ls -al *.iso *.img
   -rw-r--r--  1 root  wheel  26624000 Apr 27 03:28 6.2-RELEASE-i386-bootonly.img
   -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
  • Attach this image file as a memory disk:
   # mdconfig -a -t vnode -f 6.2-RELEASE-i386-bootonly.img -u 0
  • Write a BSD label with boot code to it:
   # bsdlabel -w -B md0 auto
  • And create a filesystem on it (BSD uses ufs):
   # newfs -m 0 md0a
   Warning: changing optimization to space because minfree is less than 8%
   /dev/md0a: 25.4MB (51984 sectors) block size 16384, fragment size 2048
           using 4 cylinder groups of 6.36MB, 407 blks, 832 inodes.
   super-block backups (for fsck -b #) at:
    160, 13184, 26208, 39232
  • Create a mount point and mount this "memory disk" device (attached to the image file):
   # mkdir /tmp/img
   # mount /dev/md0a /tmp/img
   # df /tmp/img
   Filesystem 1K-blocks Used Avail Capacity  Mounted on
   /dev/md0a      24950    4 24946     0%    /tmp/img
  • Create another mount point and mount the ISO file on it through another md device:
   # mkdir /tmp/iso
   # mdconfig -a -t vnode -f 6.2-RELEASE-i386-bootonly.iso -u 1
   # mount_cd9660 /dev/md1 /tmp/iso
   # df /tmp/iso
   Filesystem 1K-blocks  Used Avail Capacity  Mounted on
   /dev/md1       24848 24848     0   100%    /tmp/iso
  • Copy the ISO contents to the new disk image file:
   # cd /tmp/img/
   # cp -r /tmp/iso/* .
   # ls -al
   total 12
   drwxr-xr-x  4 root  wheel      512 Apr 27 03:40 .
   drwxrwxrwt  8 root  wheel      512 Apr 27 03:36 ..
   drwxrwxr-x  2 root  operator   512 Apr 27 03:35 .snap
   dr-xr-xr-x  5 root  wheel      512 Apr 27 03:40 boot
   -r--r--r--  1 root  wheel     2048 Apr 27 03:40 boot.catalog
   -r--r--r--  1 root  wheel       25 Apr 27 03:40 cdrom.inf
  • Unmount and detach all md devices:
   # cd
   # umount /tmp/img /tmp/iso
   # mdconfig -d -u 0
   # mdconfig -d -u 1
  • We're done. Copy the .img file to your tftp server.
   # ls -al *.img *.iso
   -rw-r--r--  1 root  wheel  26624000 Apr 27 03:41 6.2-RELEASE-i386-bootonly.img
   -rw-r--r--  1 root  wheel  25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
  • And add something similar to this to your pxelinux.cfg/default file:
   label freebsd62
       kernel memdisk
       append initrd=images/freebsd/6.2-RELEASE-i386-bootonly.img harddisk