g4u - Harddisk Image Cloning for PCs

Support free software or g4u WILL die!
Latest release: 2.6





1. What is it?

2. Why not one of the alternatives?

    • Server-part often runs (only) under DOS/Windows. I wanted to use a Unix based server.
    • Supported filesystems include everything from Microsoft, but others are not handled properly (Solaris/x86, NetBSD, ...)
    • I don't want to deal (ever again) with making a DOS-based bootfloppy, that gets its IP-number via DHCP.
    • I've played with doing multicast-based deployment based on imm, but the result was so slow I decided not to pursue it.

3. Requirements & Download

    • Four empty 1.44MB floppy disks, or an empty CD-R/RW or DVD
    • A FTP-server with some GB free space
    • A DHCP-server

    In addition to that, you may want:

    • The g4u 2.6 floppy images (zipped/ uncompressed floppy one, floppy two, floppy three, and floppy four)
    • The g4u 2.6 ISO CD image (zipped/uncompressed)
    • The g4u/NetBSD kernel for PXE boot (gzipped)
    • The g4u 2.6 source code
    • Some sha512 checksums:
      SHA512 (g4u-2.6-1.fs) = 1164c3b24a95afa3836a0c4317cb3aaa155aa6b6e70bdbb8c6e272dc9edb0c6a6a9d2ca8b6595a6b83db52819e493b2f1eb35bd32df97915ea44487f715058c9
      SHA512 (g4u-2.6-2.fs) = d9bdd236ba5ff5ec0bab2d1189ff2195534a6c494c6c340b65d1c84adb3bdb59a9e0ea1e45cc2dfd1420561df62b7ee40fe7bc8531ffd28f2a1b13480b801619
      SHA512 (g4u-2.6-3.fs) = 49f64a568d9f219c2785a94277d4c0937671cd9263306e5e596c5f732f6ed2802c8c6152363d484ec3510fbfe5bf37cda5a2ef7850c92c45f96fe072ac06c987
      SHA512 (g4u-2.6-4.fs) = a2daff9bb234efdc1eb20047fae3afef29b38b7c4fbfdf8a9d55679a2c64bb1e8c56134394d6d0a869c42f55b1b2b4095432add1d199cc3f75ec480001851240
      SHA512 (g4u-2.6.iso) = c885ca25c97631348eb7a69ef1de72933b8c2994174a0f1199a727bbf3cbb33f706f8e5e752af26a12396e1324e4cb182eb29b7104e7359188e2bdefc7162872
      SHA512 (g4u-kernel-2.6.gz) = 0df42b1fc269aa4d851a709e3cfd61f3c11bce614d1f2a642d1b3f61d0cad825b8ec9aea2a0ba1d1ee15f60f8f9821895d5e12b999df994c24526cfc7551eef7
      SHA512 (g4u-2.6.tgz) = b6791e0d031c39c419049416af498b0bb5eb114c0f3edf8eefa7a9f9e33df67e848aa63d39cc2298bd5cab348f021d76740f0c6e24fd46dcb459e1412acd3554
      SHA512 (g4u-2.6.fs.zip) = 843309131b2e7625d2620537c5672a1dbbaf51cc55482464dacc8087b6683ad0860a13fc7a1c7af4413a8bdf1729c861bada33ba4b00146282a5e28d78715fe8
      SHA512 (g4u-2.6.iso.zip) = 43d2beb5058b31bc48ffdac41d525a807d0c19fe26ce0dd0fa9a371d609b1f3e78dc74b1797c8f2bf2df4b0bcef798337bca4dd57ee6fac0592c18c2a405cf16
      
    • Some ms5 checksums (deprecated):
      MD5 (g4u-2.6-1.fs) = 3bc7a1e18a769676fe28bddbf330ea11
      MD5 (g4u-2.6-2.fs) = 8b55f3fe6a4806c9a65a3d176463e1bc
      MD5 (g4u-2.6-3.fs) = f4f28bd96364d597daa81ab501806b97
      MD5 (g4u-2.6-4.fs) = 49c1a4530c17d6fba281a81548749db9
      MD5 (g4u-2.6.iso) = 8d26857a90845ee6964451eca0aaadd3
      MD5 (g4u-kernel-2.6.gz) = 8da39f174fc14f43ffe5a0f0c705d848
      MD5 (g4u-2.6.tgz) = 0bee3b148566687e74ced0a77536e27d
      MD5 (g4u-2.6.fs.zip) = a16336c83b281ea31154958c9647a7fd
      MD5 (g4u-2.6.iso.zip) = de8c890046d62e1112645a5a7c511152
      

    Older versions of g4u are available as well:

4. Using it

    4.1 Preparations

    • Using the g4u floppy images:
      1. Download the floppy images, g4u-2.6-1.fs g4u-2.6-2.fs g4u-2.6-3.fs and g4u-2.6-4.fs or g4u-2.6.fs.zip, which contains these files.
      2. If you downloaded the g4u-2.6.fs.zip file, unpack it to get g4u-2.6-1.fs, g4u-2.6-2.fs, g4u-2.6-3.fs, and g4u-2.6-4.fs
      3. Write the floppy "fs" images to seperate floppy disk. Under Unix, a simple "cat g4u-2.6-1.fs >/dev/diskette" (and same for -2.fs etc.) will do. Make yourself familiar with the name of your floppy device, some common ones are:

        • NetBSD: /dev/fd0a
        • Solaris: /dev/diskette
        • Linux: /dev/fd0

        There are also similar devices for USB sticks, but you need to grab the g4u.fs from the ISO to put there:

        • NetBSD: /dev/sd0d
        • Linux: /dev/sd0

        If you're using Microsoft Windows or DOS, use rawrite.exe. There's also a Windows-based program available called rawr32.zip.

    • Using the g4u CDROM ISO image:
      1. Download the CDROM ISO image, g4u-2.6.iso or g4u-2.6.iso.zip
      2. If you downloaded the g4u-2.6.iso.zip file, unpack it to get g4u-2.6.iso
      3. Please consult your CDROM writing software (Nero, DiskJuggler, WinOnCD, cdrecord, ...) 's manual on how to write the g4u.iso file to a CDROM. Note that the image is bootable.

    • On a FTP server of your choice, create an user-account called "install", and protect it with some password. Make sure the 'install' user can login via ftp (/etc/shells...)

      If you want to use a different account, you can specify "login@server" for slurpdisk, uploaddisk etc..

    • Make sure you have a working DHCP server that hands out IP addresses and other data needed to access the FTP server from your workstation (name server, netmask, default gateway). Else you will have to set the IP-number manually..

    4.2 Image creation

    • Boot the CD or floppy on the machine you want to clone. See it read the kernel from disk, then print out all the devices found in the machine. It will do DHCP next, asking for an IP number - be sure you have DHCP configured properly! At the end you'll get a text description of possible commands, and a shell prompt.

    • Whole harddisk:
      Type "uploaddisk your.ftp.server.com filename.gz" to read out the machine's harddisk (rwd0d), and put it into the "install" account of your FTP server under the given filename. The disk image is compressed (with gzip -9), so maybe use a ".gz" file suffix. You don't have to, though. Before putting the file on the FTP server, the "install" account's password is requested.

      If you want to clone your second IDE disk, add it's name on the uploaddisk command line: "uploaddisk your.ftp.server.com filename.gz wd1". Similarly, if you use SCSI instead of IDE disks, use "uploaddisk your.ftp.server.com filename.gz sd0".

      If you want to use a different account name than "install", use "account@your.ftp.server.com" for both uploaddisk and slurpdisk.

    • One partition only:
      Get an overview of disks recognized by g4u by typing "disks", a list of partitions on a certain disk is available via "parts disk", where disk is one of the disks printed by "parts", e.g. wd0, wd1, sd0, etc. Partitions are numbered with letters starting from 'a', where partitions a-d are usually predefined, with your partitions starting at 'e'. Partitions here are BSD-partitions, which have little in common with DOS MBR partitions. To specify a partition, use something like "wd0e" or "sd0f": "uploadpart your.ftp.server.com filename.gz wd0e". Run "uploadpart" without arguments for more examples.

    • Wait until you're back at the shell prompt (ignore the errors :-). Depending on your network, CPU, harddisk hardware and contents, image creation can take several hours!
    • You can switch off the machine now. Type "halt" or simply press reset/power button - there are no filesystems mounted so no harm will result.
    • Check that your FTP server's "install" account now has the image file.

    4.3 Image deployment

    • Boot the CD or floppy to the shell prompt again, see above.

    • Whole harddisk:
      Type "slurpdisk your.ftp.server.com filename.gz". This will log into the FTP server's "install" account, verify the password, then retrieve the image, uncompress it and write it back to /dev/rwd0d.

      If you want to restore to a SCSI disk, add the disk's name to the slurpdisk command line, e.g. "slurpdisk your.ftp.server.com filename.gz sd0".

      See above if you want to use an account name other than "install".

    • One partition:
      Use "slurppart your.ftp.server.com filename.gz wd0e" or whatever values you passed to uploadpart. Please note that the partition information is taken from your MBR, which is expected to be the same as before image creation - expect surprises if you change something between image creation and deployment. In case of inevitable changes, check the start sector and size values given by "parts". For an image that includes the MBR, do a full backup with "uploaddisk".

    • Reboot the machine (type "reboot" or press reset button), and see if your machine comes up as expected - it should!

    4.4 Copying a disk locally

      If you just want to copy one local disk to another one with no network & server involved, the "copydisk" command is what you want. E.g. to copy the first IDE disk to the second IDE disk, use "copydisk wd0 wd1", to do the same for SCSI disks run "copydisk sd0 sd1".

      Beware! All data on the target disk will be erased!

      A list of disks as found during system startup can be found using the "disks" command.

    4.5 Copying a partition locally

      If you want to only copy one local partition to another local partition (similar to what 'uploadpart' and 'slurppart' do, just without the network and FTP in between), this can be done with the 'copypart' command. It takes two partition names as arguments, and copies the contents of one partition to the other. As an example if you found you want to copy your first local partition 'wd0e' to the second one 'wd0f', run:
      copypart wd0e wd0f
      
      A list of disks can be found using the 'disk' command, to list all the partitions on a disk use the 'parts' command. Partitions have the form of "wd0d", "w1e", "sd1f".

      Be aware that the partitions to copy should have identical size (down to the sector), else funny things will happen. When copying a 'big' partition into a 'small' one, g4u won't thrash the data behind the 'small' partition, but of course the copy is not complete either. Take special note that that case could happen when you restore a copy made that way, and which went fine when you first copied your small working partition to your big backup partition!

5. FAQs and hints on disk cloning

    5.1 Supported filesystems

      One of the questions arising a lot is "what filesystems does g4u support". The answer is: "all of them". g4u reads the disk bit by bit, starting from byte #0 to the end. It includes any MBR, boot record, partition table and the partitions themselves without further investigating the structure of the data stored in these partitions.

    5.2 Supported Operating Systems

      The question on operating systems that can be deployed with g4u is the same as for the filesystems: any. Given the image-approach again, g4u is able to handle any operating system. Systems that were cloned successfully include NetBSD, Linux, Novell Netware 4.11 and 5.1, Solaris/x86, Windows NT, 2000 and XP.

      By moving the harddisks to a PC, g4u can even be used to deploy operating systems for non-PC based SCSI machines running HP-UX, Irix, Solaris, AIX etc.

    5.3 Supported Hardware

      The system running g4u itself can have IDE, SATA, SCSI or RAID disks with various controllers (Adaptec, ...) as well as wide range of PCMCIA, Cardbus, ISA and PCI network cards. Please see the g4u kernel config for the full list of supported hardware.

      If you're unsure if your hardware is supported, simply boot g4u and see if your network card gets listed by "ifconfig -a" and if your disks get listed by the "disks" command. If not, adding relevant parts of "dmesg" output (from g4u; press space bar to scroll down) is required for analysis if you ask for help. See "Reporting problems" for more information.

    5.4 A word on disk sizes

      The question how g4u deals with different disk sizes arises a lot too. The general answer is, g4u works best with identical disk sizes & geometry. Putting an image from a small disk on a big disk works, putting an image from a big disk to a small disk is likely to cause problems.

      If you cannot avoid preparing an image on a big disk that'll get deployed to a small disk later, make sure the "extra" space is not occupied by a active partition or filesystem, else data loss is very likely to occur!

      If you intend to deploy a "small" image to a "big" disk, the extra space that's not covered by g4u can be used for creating a partition and a filesystem. You will have to do that on your own, e.g. using your operating systems' post installation steps.

    5.5 Changing compression level

      Per default, images uploaded to the FTP server are compressed with "gzip -9". This saves as much disk space as possible, but also takes a long time - several hours are not uncommon. You can reduce the gzip level for "uploaddisk" by setting the GZIP environment variable:

      # GZIP=1 uploaddisk your.ftp.server.com filename.gz
      
      You can change compression levels between 1 (fast, little compression) and 9 (slow, maximum compression). Of course you can specify all the usual options to uploaddisk.

    5.6 List of recognized disks

      During startup of g4u, all devices recognized are listed, but very fast. To get a list of recognized disks, use the 'disks' command:

      # disks
      wd0 at pciide0 channel 0 drive 0: 
      wd0: drive supports 16-sector pio transfers, lba addressing
      wd0: 6149 MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
      wd0: 32-bit data port
      wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
      wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)
      The above example shows a 6GB IDE harddisk.

    5.7 Problems with images at 2GB

      Do you experience g4u aborting file transfers after the image has grown to 2 GB on the FTP server? The problem here is not g4u, but most likely your FTP server. Some older Linux distributions are known to only allow files of up to 2GB filesize, and even if there is a Linux 2.4 kernel running, that's no guarantee for a properly working server. Make sure that your ftp daemon is upto date, or install a decent operating system.

      So far, whatever FTP server comes with NetBSD, Solaris and Windows 2000 has been used without problems.

    5.8 Can you add feature XXX?

      I got requests for adding many features to g4u:

      • using TFTP
      • using SSH/scp
      • using NFS
      • adding a X or curses based GUI
      • writing images to CDROM / deployment from CDROM
      • bzip2 compression

      After moving to a two-floppy set for g4u, some of these features may be added in the future, while others (X...) are not likely. Stay tuned!

    5.9 Problems with network performance

      If upload performance is weak (less than 5MBytes/sec on a 100BaseT Ethernet switch) even with a small compression level or a fast CPU and the harddisk is idle this means the network sucks. A common problem in switched Ethernet is a duplex mismatch between the NIC and the switch. In NetBSD, the default is to negotiate speed and duplex automatically. Other settings can be set manually.

      Enforcing 100BaseTX/Full-duplex:

      # ifconfig fxp0 media 100BaseTX mediaopt Full-duplex
      # ifconfig -a
       fxp0: flags=[...] 
       media: Ethernet 100baseTX full-duplex 
      Using autonegotiation (default):

      # ifconfig fxp0 media auto
      # ifconfig -a
       fxp0: flags=[...] 
       media: Ethernet autoselect (100baseTX)

      For more information, please see the ifconfig(8) manpage as well as the Auto-Negotiation Valid Configuration Table featuring "Why Can't the Speed and Duplex Be Hardcoded On Only One Link Partner?".

    5.10 Reducing the image size

      People complain that the image resulting from g4u is very big. This is normal as g4u clones the whole disks with all blocks, not attributing if they contain any valid data or if they are empty/unused. To find empty/unused blocks (and not clone them), g4u would need intimate understanding of the contained filesystem, which is different again for each filesystem - Windows FAT, Linux Ext2/3/ReiserFS/..., BSD FFS, Solaris UFS, etc. Given both tight space limitations on the floppy as well as shortage on filesystem documentation and implementations available, teaching g4u to ignore empty blocks is not likely to happen.

      But there is an easy way to circumvent the problem: use the native operating system's understanding (and implementation) of the filesystem, and make sure it prepares empty/unused blocks in a way so they don't contain random garbage data but values which can be compressed easily by g4u, thus resulting in small image sizes.

      Effectively, you just fill up the disk's unused blocks with zero-bytes. Open file for writing, stuff in 0-bytes until the disk is full, then close the file and remove it. The result is that all unused blocks were used by the file, and filled with data that g4u can then compress easily. Usually the operating system will just mark the blocks as unused, without changing the actual data content.

      Using this technique on a 20GB disk that had 6GB Solaris 8/x86 and the rest Windows 2000 Workstation shrunk the image from ~6GB compressed to ~2GB compressed. You can probably imagine the effect of this on deployment time too. :)

      To perform the filling of unused data blocks with zero-bytes, there are several ways, depending on what operating system you use on your computer, and what software you have available:

      Standard Unix:
      This works on any Unix variant - Linux, NetBSD, Solaris, etc.:
      dd if=/dev/zero of=/0bits bs=20971520 # bs=20m
      rm /0bits

      Windows Perl solution:
      This one needs perl installed. In a command shell, type:
      cd /d c:\
      c:\win-preclone.pl c:
      Click here to download the win-preclone.pl perl script.

      Windows Pascal solution:
      This pascal program was contributed by Matthias Jordan [mjordan at code-fu dot de]: The programs are provided here without warranty.

      64bit Windows binary:
      Dominic Leelodharry [dominic at authorsoftware d0t com] also sent me a binary for 64bit Windows: This program is provided here without warranty.

      Windows "Erasor":
      This freeware program can erase your disk in a safe way, but it can also be told to just write a pattern of all-0-bits to the disk. Grab it at www.heidi.ie/eraser. Thanks to Stephen Krans [s040 at krans dot org] for the hint!

      Windows "onboard" solution:
      Aparently Windows XP comes with a tool to do some harddisk encryption that can also be used to write 0-bytes to the disk. To do so, run the following command: cipher /W:C: for drive C:. You will need to abort (Control+C) after the first round, else it will write random data after filling the disk nicely with 0-bytes.

      Run any of these right before shutting down the operating system to create an image with g4u, and see the size difference.

    5.11 Setting IP-number manually

      Sometimes you may not want or be able to use DHCP. In that case doing the network configuration manually is possible with g4u, too:

      1. Find out if your network device is recognized, and by what name, using the command

         ifconfig -a
        Your network device is something like "ex0", "tlp0", etc. (Note that unlike in Linux, NetBSD doesn't call all ethernet cards "eth0"!)

      2. Next configure the network device's IP number and netmask. It is assumed that your network device is xx0 here, and that the machine should run with IP number 1.2.3.4 and netmask 255.255.255.0:

         ifconfig xx0 1.2.3.4 netmask 255.255.255.0
      3. Last, you may want to make the default router known unless your FTP server is in the same IP subnet as the machine you want to use g4u on. Let's say the default router's IP address is 2.3.4.5, then the command to enter is:

         route add default 2.3.4.5 
      That's all - simple, huh? Just remember that g4u is still Unix! After these steps, you should be able to use g4u just as if it used DHCP.

    5.12 Extracting the g4u kernel

      Starting with version 2.6, a kernel is already included in the distribution, as file g4u-kernel-2.6.gz, e.g. to boot g4u from harddisk or via PXE.

      The idea is to extract the kernel from the boot floppy, and hand that to grub (or whatever bootloader you want - maybe use PXE to netboot g4u). Here's how to extract the kernel, named "netbsd":

      % ( cat g4u-2.6-1.fs | dd bs=512 skip=16 ; \
      ?  cat g4u-2.6-2.fs | dd bs=512 skip=16 ; \
      ?  cat g4u-2.6-3.fs | dd bs=512 skip=16 ; \
      ?  cat g4u-2.6-4.fs | dd bs=512 skip=16 \
      ? ) | tar vxf -
      -r--r--r-- 1 feyrer netbsd 53948 Nov 3 23:08 boot
      -rw-rw-r-- 1 feyrer netbsd 1479905 Nov 3 23:08 netbsd
      
      Note that the kernel ("netbsd") is actually still compressed, which is fine for the NetBSD bootloader and probably GRUB, but just in case, you may want to uncompress it:
      % file netbsd
      netbsd: gzip compressed data, was "netbsd-INSTALL_G4U", from Unix
      % mv netbsd netbsd.gz
      % gunzip netbsd.gz 
      % ls -la netbsd
      -rw-rw-r-- 1 feyrer wheel 5523084 Dec 7 18:08 netbsd
      % file netbsd
      netbsd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped 

5.13 Netbooting g4u via PXE

5.14 What FTP server software to use?

    When you're uploading or downloading images to or from your FTP server, and you see a line like
     553 Cannot send file larger than 4 gigabytes 
    scroll by, you can assume that that line (and any others with a number at the start) originates from your FTP server, and it is thus not g4u that's buggy but your FTP server software that has a problem.

    Some known working FTP server programs are:

    • NetBSD's ftpd(8) that comes in the default installation
    • GuildFTPd on Windows XP
    • The FTP server that comes with Microsoft Windows 2000 and 2003 Server (there seem to be problems with any FTP servers that come with non-"Server"-Versions of MS Windows...)
    • vsftpd on your favourite Linux distribution (reported working: Fedora 2, Debian Sarge)
    • Cerberus FTP
    • Novell Netware's FTP server (reported working: Netware 6)
    • TYPSoft FTP Server on a USB memory stick with Windows XP
    • Filezilla Server on Windows 98SE and XP
    • Mac OS X and Mac OS X Server's FTP daemon
    • Bullet Proof FTP Server v. 2.3.1 (Build 26)
    • Pure-FTPd
    • MOVEit DMZ
    • ProFTPD
    • SlimFTPd
    • (More? Let me know!)

5.15 Booting g4u from USB

    Currently, there is no bootable image available that can be put on an USB stick. But there's a link to Jared McNeill's blog which describes how to transmogrify an ISO image into a USB/disk image.

5.16 Non-standard applications

    g4u was originally made to setup a cluster of PCs. Since then, it has been used for several other types of hardware and application areas. I'd like to collect some of them here:
    • Copied a dual drive Tivo
    • Saved Novell NetWare server disks
    • Copied a Nokia IP330 Checkpoint Firewall 1 boxes
    • Install several clusters of firewalls, compute machines, school workstations, etc.
    • Cloned Symbol WS5000 and WS5100 wireless switches
    • ...
    Please send me mail if you've used g4u to clone something funny, cool, unusal, geeky, etc.!

6. Support and reporting problems

    6.1 Support

      The following ways of getting support for g4u exist:

      • Mailing list: g4u-announce@feyrer.de
        This list will contain announces about g4u only.

        • Subscribe or change your settings via the web, or
        • send a mail with "subscribe yourpassword" to g4u-announce-request@feyrer.de to subscribe. Please replace "yourpassword" with your personal, secret list password.
        • Look at the g4u-announce list archive.

      • Mailing list: g4u-help@feyrer.de
        This list is intended for questions and answers about g4u.

        • Subscribe or change your settings via the web, or
        • send a mail with "subscribe yourpassword" to g4u-help-request@feyrer.de to subscribe. Please replace "yourpassword" with your personal, secret list password.
        • Look at the g4u-help list archive (Alternative: mail-archive.com).
      • Orkut "g4u" community:

        There's a "g4u" community at Orkut which I've created as a forum for g4u. As Orkut is too slow these days (Dec 2004), I won't follow discussion on Orkut a lot, and recommend using the above-mentioned mailing lists for getting timely response.

      • Optional(!) commercial license are available, see the "Commercial license" page for more information.

    6.2 Reporting problems

      If you have trouble with g4u and want to report a problem, PLEASE add the following information. It's impossible to help you without knowing details on your systems & setup:

      • What g4u version do you use
      • What exact command(s) did you use
      • What exact output did you get (all of it, 1:1, no interpretation on your own)?
      • If the system hangs during boot: what are the last five lines printed on the screen (again all of them, verbatime)
      • What does "disks" say? "parts"?
      • If you have some problems with some network card or disk driver, please include the relevant parts from "dmesg" output (scroll down with 'space')
      • What operating system, filesystem type and FTP server software do you use on your FTP server?

      Send your bug reports to the g4u-help mailing list.

    6.3 Blog

7. Rebuilding from source

    G4u is based on NetBSD boot floppy disk set. It consists of a custom kernel and custom bootfloppy, both stripped down to an absolute minimum to fit on a small number of 1.44MB floppy disk, or a CDROM ISO. There are also the "copydisk", "uploaddisk" and "slurpdisk" scripts.

    To rebuild the images:

    • Note that for rebuilding, no root permissions are needed any more! Below, the "#" prompt shows action needed as root, "%" is the prompt for commands executed as user.

    • Get a i386/PC machine running NetBSD 7.0. Cross-building from other Unix-like operating systems should work, currently only crossbuilding from Mac OS X is tested.

    • Get NetBSD-current source from ~Apr 18th 2017 as /usr/src:
       % su 
       # mkdir /usr/cvs
       # chown $USER /usr/cvs
       # ln -s cvs/src /usr/src
       # exit
       % cd /usr/cvs
       % env CVS_RSH=ssh cvs -d anoncvs@anoncvs.netbsd.org:/cvsroot co -P -D 20170418 src 
      Note that newer dates may or may not work, the above date is what the release was built and tested with.

    • Get the g4u 2.6 sources

    • Unpack the g4u sources:
       % cd /usr/src
       % tar plzvxf .../g4u-2.6.tgz
    • Tweak build settings:
       % su -
       # touch /etc/mk.conf
       # chown $USER /etc/mk.conf
       # exit
       % echo OBJMACHINE=1 >>/etc/mk.conf
       % 
    • Build g4u, which requires a full build of NetBSD userland and a kernel:
       % cd /usr/src
       % sh g4u-build 
      Depending on your machine, this will take some time!

    • After that, you'll find "g4u1.fs", "g4u1.fs" and "g4u.iso" in /usr/src/distrib/i386/g4u:
       % ls -l /usr/cvs/src/distrib/i386/g4u/g4u*
       -rw-r--r-- 1 feyrer staff 6035496 Apr 20 00:57 g4u-kernel.gz
       -rw-r--r-- 2 feyrer staff 6567936 Apr 20 00:57 g4u.iso
       -rw-r--r-- 2 feyrer staff 1474560 Apr 20 00:56 g4u1.fs
       -rw-r--r-- 2 feyrer staff 1474560 Apr 20 00:56 g4u2.fs
       -rw-r--r-- 2 feyrer staff 1474560 Apr 20 00:56 g4u3.fs
       -rw-r--r-- 2 feyrer staff 1474560 Apr 20 00:56 g4u4.fs 

8. Links & Ressources

  • A tutorial for installing M0n0wall with g4u:
  • Roberto Pereyra provided me with instructions on how to install the M0n0wall firewall with g4u. Cool to see them provide their own disk images!

  • Harvesting GUIDs / UUIDs for RIS prestaged computer accounts
  • ``One of the most time consuming and overly repetitive tasks in supporting an organization with a large number of computers is handling turnover and new machine orders. A typical setup consisted of copying down the MAC addresses and destination hostnames on a piece of paper, typing them up and emailing them to someone else, update the dhcp server, etc., etc. This project is to reduce the ammount of human intervention needed to set up a machine.'' And as a bonus, it's also based on NetBSD! :) [link]

  • MIDS - g4u with user dialogue
  • Rob Bennett has modified g4u to load more code from an FTP server, to implement things like a (curses based) user dialogue, etc. While g4u's intent is to have everything on the boot media, this is definitely worth a look!

  • The iR110/150 (sparc64) dd Network Backup Page:
  • People have asked me for a UltraSPARC (sparc64) based version of g4u. Well here's one: The iR110/150 dd Network Backup Page documents scripts that do disk backups of an UltraSPARC system to a remote NFS server. Bonus to the author for using Solaris! :-)

  • Yet Another Ghost Installer (YAGI):
  • Daniel Ettle's diploma thesis which I supervised, about a network based installer at Toshiba Regensburg Operations.

  • Symantec Ghost
  • Commercial product that didn't do what I needed and which led me to create g4u. Still, check it our if you want non-image based cloning. If you think they're too expensive, remember that I don't want to starve too. :)

9. History

    Still 2.6 Updated Welcome-Screenshot with recent screen of g4u booted, and make sure the CVS checkout gets empty directories pruned (add -P for cvs co). [20181212]
    2.6 g4u 2.6 was released after a brief testing period. Major changes include:
    • Make this build with NetBSD-current sources as of 2017年04月17日 (shortly before netbsd-8 release branch), binaries were cross-compiled from Mac OS X 10.10
    • Many new drivers, bugfixes and improvements from NetBSD-current (see beta1 and beta2 announcements)
    • Go back to keeping the disk image inside the kernel as ramdisk, do not load it as separate module. Less error prone, and allows to boot the g4u (NetBSD) kernel from a single file e.g. via PXE (Testing and documentation updates welcome!)
    • Actually DO provide the g4u (NetBSD) kernel with the embedded g4u disk image from now on, as separate file, g4u-kernel.gz
    • In addition to MD5, add SHA512 checksums
    • Happy 18th Birthday, g4u!

    I've also put an article about the g4u 2.6 release in my NetBSD blog - have a look! [20170608]

    2.6beta2 was released after snoozing for only four years. See my blog for more information. Happy 18th Birthday, g4u! [20170420]
    2.6beta1 was released, see my blog [20131110]
    2.5 After an extended time for beta testing, I'm pushing out g4u V2.5 now, with no functional changes between 2.5beta1 and the final release. Of course full release testing was done on the final release. G4u 2.5 is mainly a maintenance release that brings in driver updates from NetBSD, and some minor enhancements like (finally!) enabling command line history.

    Here's a full list of changes:

    • New commands "uploadmbr" and "slurpmbr" to backup and restore the master boot record, which includes the partition table. Required to restore a partition to an empty disk.
    • New command "copymbr" to copy the MBR from one disk to another, similar to "copydisk"
    • New command "wipedisk" to write the disk full with 0-bytes once from start (sector 0) to end (last sector)
    • Enable command line history/editing by forcing /bin/sh to be built without -DSMALL (ugly hack... there be lots of dragons!)
    • When setting up a fresh compile tree, g4u patches are now applied automagically without aborting the build
    • Error detection was now enabled in the dd(1) command, which is the core of g4u (surprise!). With that, disks with broken/unreadable sectors should now be copied, skipping the unreadable sectors and copying the rest. This affects a number of programs: copydisk, copypart, uploaddisk, uploadpart. BEWARE: I wasn't able to actually test this as I do not have a disk with bad sectors here. Please report back your experiences!!!
    • Make this build with NetBSD-current sources as of 2012年01月12日
    • New drivers added to the kernel:
      • RDC PMX-1000 IDE controllers
      • Intel SCH IDE controllers
      • TOSHIBA PICCOLO controllers
      • Attansic/Atheros L1C/L2C Ethernet
      • Broadcom BCM43xx wireless
      • Agere/LSI ET1310/ET1301 Gigabit Ethernet
      • RDC R6040 10/100 Ethernet
      • USB LCDs and USB-VGA adaptors, e.g.:
      • DisplayLink DL-1x0/1x5
      • Option N.V. Wireless USB WAN modems
      • Microsoft RNDIS specifications USB ethernet
      • Atheros AR9001U USB Wifi
      • Intersil PrismGT USB Wifi
      • Virtio PCI, memory balloon, disk & network devices
      • ... and many more that slipped past QA
    • ... and any driver updates, optimizations and bug fixes and other enhancements from NetBSD-current
    [20120613]
    2.5beta1 This is a test release to get feedback on a bunch of new features, most importantly master boot record (MBR, includes partition table) backup/restore and being able to handle disks with bad sectors. Also, I finally got around to enable command line editing / history. For more information and download links, see my blog. [20120114]
    Still 2.4 The netbooting chapter was updated with a more recent link, and some dead links were removed. [20111121]
    2.4 was finally released after three years. Major updates include
    • Major new supported device types include bluetooth keyboards and SD/MMC cards - feedback highly appreciated!
    • Lots of new drivers. Too many to list, please see the g4u section of my blog for details.
    • Based on the NetBSD development version from Sep 2009
    • Source builds native and without root privileges on NetBSD 5.0 and crossbuilds also without root privileges from Mac OS X (tested) and probably others (untested; expected: Solaris, Linux).
    Also, see my blog. [20091025]
    2.4alpha4 was released, see my blog [20090831]
    2.4alpha3 was released, see my blog [20081122]
    2.4alpha2 was released, see my blog [20080120]
    2.4alpha1 was released, see my blog [20070808]
    2.3 Final release, no substantial changes from the latest beta. Changes over 2.2 include updated drivers based on the latest development version of NetBSD, a complete overhaul of the build system to remove the 2.88MB size limit, and availability of contracts for technical support. Some links for downloading: Floppies (uncompressed one, two; all floppies ZIP compressed), ISOs (uncompressed, ZIP compressed), source. [20070125]
    2.3beta3 Move towards pushing out a release to have the build infrastructure updates available. The kernel got audio and other irrelevant drivers shaved off. Include floppies this time. Some links for downloading: Floppies (uncompressed one, two; all floppies ZIP compressed), ISOs (uncompressed, ZIP compressed), source. [20061228]
    2.3alpha6 I've released 2.3alpha6 which mainly contains updated drivers, as reaction to all those new Dell machines etc. people mention on the g4u-help list. If you send bug reports, please DO INCLUDE DMESG OUTPUT, see bugreporting! [20061102]
    still 2.2 As proposed in my blog, I have enabled Google ads on the front page, to keep you informed. If you come across anything interesting, feel free to inform yourself! :-) For those that don't follow the mailing lists, a bunch of 2.3alpha versions have been put out, it's currently at 2.3alpha5. [20060919]
    2.2 Final release, no functional changes over 2.2beta2 (see below), some documentation updates. [20060531]
    2.2beta2 Preparing a new major release, I'm releasing this beta version for some public testing plus to have the full load of updated drivers available rather sooner than later, as more and more people keep asking. Changes to look forward in g4u 2.2:

    • The build infrastructure was changed: The kernel used is now based on a GENERIC kernel with ramdisk hooks, instead of a customized INSTALL kernel. There's still a ramdisk embedded in the kernel, and that kernel+ramdisk are used to build the ISO and floppy-set. My main motivation for this release is to utilize NetBSD's 'makefs -t cd9660' and bootxx_cd9660 for creating the ISO version, the floppy splits the kernel+ramdisk over (now) three floppies using NetBSD's ustarfs. This approach allows growing the ramdisk with more programs without the 2.88MB limit imposed by harddisk-emulation-booting and mkisofs before, to an (sort of) arbitrary size. Size restrictions right now are the size of the CD and (more likely) the size of the ramdisk that can fit into RAM, see below.
    • Password entry in all scripts is now without echo (added stty(1) to run 'stty -noecho')
    • The G4U kernel is now a real NetBSD "GENERIC" kernel with an embedded ramdisk, with all the devices supported there. The trade-in for the reduced maintenance costs are a minimum of 16MB RAM needed now. Please let me know if this is an issue!
    • Updated hardware support to match NetBSD-current's GENERIC as of 20060406, adding support for Workbit NinjaSCSI-32 (pci); Symbios 53c875 SCSI and newer (pci); Qlogic ESP406/FAS408 SCSI (pcmcia); Cardbus SCSI including AdvanSys 1200[A,B], 9xx[U,UA] SCSI, Adaptec ADP-1480, Workbit NinjaSCSI-32; Intel 82597 10GbE LR NIC (pci); Sun Microelectronics STP2002-STQ (pci); Intel PRO/Wireless 2100 and 2200BG (pci; may not work due to missing firmware); PCnet-PCI Ethernet (pci); ralink wifi (pci); 3com 3cr990 (pci); VIATech VT612X Gigabit Ethernet (pci); Neterion (S2io) Xframe-I 10GbE (pci); BayStack 660 (802.11FH/DS, pcmcia); Cardbus NICs including Atheros 5210/5211/5212 802.11, ADMtek ADM8211 (802.11), 3Com 3C575TX, Intel i8255x, Realtek 8129/8139/8180L (802.11) and DECchip 21143; CDC, Ethernet Networking Control Model and Davicom DM9601 based USB-ethernet adapters; Atmel AT76C50XX based adapters and Ralink Technology RT25x0 802.11a/b/g USB WLAN adapters
    • TODO for 2.2: disable non-working progress bar that appears in copydisk & uploadpart that shouldn't appear (and doesn't in all the other commands).
    • I've added an item "What FTP server software to use?" to the FAQ list.
    • I've added a reference to the g4u blog (or rather, the g4u part of my NetBSD blog :).
    2.2beta1 Was never released publically
    Still 2.1 Added PXE netboot information
    2.1 Changes: Added serial drivers (com on isapnp and isa) back for those people that need serial console (a few asked...), added support for IT Express and ATI IXP IDE and Promise SATA150 controllers, many bugfixes and enhancements from NetBSD-current, including EHCI-based USB improvements, and "dmesg" now hints at pressing space/CR to scroll down [20050622]
    2.0 Yes, that's 2.0 - really! I got so fed up with the constand lack of space on the g4u floppy version that I finally decided to end the never-ending madness of removing drivers to make it fit. Instead, there are two versions of g4u now: a CDROM-version (can also be used on DVD at no extra costs), and a TWO-floppy-version (consisting of, well, TWO floppies, instead of the one used so far)! When booting the floppy version, it will load the first floppy, then ask for the second one. Press RETURN, and it will load the second floppy. (The splitting onto more than one floppy was made possible by NetBSD's fine infrastructure which is used for g4u, and which allows booting from a multi-volume tar-archive).

    The floppy and CDROM version still share the same codebase - there's still a limit of 2.88MB now, but this allows me adding back all the drivers I had to remove in the past:

    • The wscons console driver, which allows using USB keyboards
    • SATA drives (updated)
    • I2O devices
    • CS8900 (ISA) Ethernet
    • Alteon ACEnic gigabit Ethernet
    • PCMCIA and Cardbus drivers for SCSI, IDE and a *lot* of ethernet and wireless network cards.
    • Fiber Channel drivers for your SAN!
    • Hardware RAID drivers: Adaptec AAC family, AMI/LSI Logic MegaRAID, Compaq PCI array controllers, ICP-Vortex GDT and Intel RAID, Mylex DAC960 & DEC SWXCR family and 3ware Escalade RAID controllers. Whee!
    • Wireless LAN cards: Aironet PC4500/PC4800, Atheros 5210/5211/5212, ADMtek ADM8211, Intersil Prism Mini-PCI.
    • Token Ring drivers for both PCMCIA and ISA IBM/3COM TROPIC cards

    Besides all these drivers which were previously removed from g4u and now added back, be sure to check out the full list of supported hardware, including more wavelan cards, gigabit ethernet and SATA drives!

    Another minor addition made in this release is the 'copypart' program, which can be used to, well, copy single partitions locally. See Copying a partition locally for more information.

    So, this all sounds like christmas? That's a bit away, but maybe you want to donate a bit so I can buy myself and my beloved some nice present (and maybe even one that allows me to do a port of g4u to an Apple PowerBook G4? *hint, hint*)? ;)

    Those that want to do some good not only to me but to themselves and their beloved too can now aquire an optional commercial license for g4u. g4u will remain free to use for both private and commercial users, but I've received many requests for commercial licenses, and here they are!

    Last but not least, I'm fed up with the slowness of Orkut, and using the infrastructure from Source Forge, I've created two mailing lists, one for g4u related announces, and one for general questions on g4u. See the support section for more information.
    [20041207]

    Still 1.17 Today I had to discover that someone used g4u as a source for g4l, but instead of giving proper credit and respecting the licensing and copyright on g4u, all traces were removed that the core work was done by me. Instead, the author put his name in and his work under a different license. I'm not happy about this, and ask people to discourage such actions as well as to despise the the author of g4l (cowardly calling himself only "nme"). Read more about this in my blog.
    1.17 Major bugfix release which intends to address all the flaws in previous releases (see release notes for 1.15 and 1.16)! Besides the Freshmeat g4u page, interested parties can now find a g4u community with forum etc. on Orkut - drop me a mail if you want/need an invitation or have any questions (just as before :)! [20040718]
    Back to 1.15! There's a critical flaw in slurpdisk and other restore facilities in 1.16, which render g4u 1.16 unusable. The QA team has been fired, and we're back to 1.15. Sorry! :( [20040702]
    1.16 OK, let's see if I got things right this time: Fixed copydisk, which I broke while adding the progress bar code. Document default GZIP level when calling uploaddisk and uploadpart with no argument. Shaved more space from the config by going for the generic PCIIDE driver (only; please let me know if this made things a lot slower and if it killed SATA-support esp. if enabling IDE in your BIOS won't help - and send me a SATA-equipped machine to test this in the future! :-), removed 'rnd', gave the kernel a fixed device to start from (the ramdisk), removed COMPAT_*. Replaced console driver - you may need to turn on support for USB keyboards in your BIOS! [20040630]
    still 1.15 There's a bug in the "copydisk" command of g4u 1.15, please use g4u 1.14 if you need the copydisk command.
    still 1.15 I have a donations page now!
    1.15 Finally: Improved progress report! No more dots, volume transferred and current throughput is printed instead. Other changes: 'help' command to re-print help screen; update help screen a bit and made the prompt look a bit friendlier. Consistent GZIP handling. Building as non-root is now fully working (Thanks NetBSD!). No more Token Ring drivers, sorry, ran into space issues again. Thank for everyone who has donated so far, I'm working on a donations page. FWIW, donations of books from Amazon are welcome as well, see my wishlist: [20040412]
    1.14 After some minor *cough* bugs in 1.13, here's 1.14. No more "file system full" etc., no functional changes either. Added a few screenshots to the documentation. Keep the donations coming! :-) [20040218]
    Still 1.13 Source update! The sources released for 1.13 had a small problem (missing gz_compress, etc. while linking), I've updated the g4u-1.13.tgz source archive. Proper checksums are 2226011164 (CRC, cksum(1)) and fa2e2f00b079be1a9cf1c81d625896b1 (MD5). [20040122]
    1.13 13's a bad sign, and version 1.13 means so for g4u. Due to my job situation I'm not sure if I can continue working on g4u in the future. Your donations can motivate to do so - paypal@feyrer.de is waiting for you. Today, g4u is mentioned in in one place with commercial products like PowerQuests's DriveImage and Norton's Ghost. g4u is free software and I hoped upon it's users to support it via donations. If I just got 10ドル from everyone sending me questions about g4u, that'd be more than enough. Fact is that only 1 person has donated back some money so far. Here's your chance to contribute back to the Open Source community - join in!

    Griping aside, V1.13 is a wrapup based on NetBSD-current as of Jan 14th 2004, esp. made after many people hat troubles booting 1.12. New drivers are for Adaptec 29320, 39320 (aic790x) SCSI (ahd), Broadcom 4401 10/100 Ethernet (bge), DECchip 21x4x and clones Ethernet (tlp), Intel 8254x gigabit (wm), Intel IGP01E1000 MII driver (igphy), Intel i31244 and SiI SATALink SATA controllers. See the g4u kernel config file for all the details. Matthias Jordan has also sent me an update of his "nullfile" to v1.02 which I've added to the g4u webpage.

    Due to some things growing again, I had to remove all Wireless LAN and most PCI RAID controller drivers. Maybe it's time to start special g4u versions for laptops (with pcmcia, cardbus, usb, wavelan), servers (with raid, ...) in addition to the current version of g4u. Let me know if you're interested! [20040111]

    1.13pre2 Prerelease of 1.13 ISO after many people had problems booting the 1.12 ISO. No new features, but two administrative things to note: First, I've lost my job on Jan 1st 2004 due to the Bavarian government killing jobs in academics. That job was the main motivation behind creating g4u, and development of g4u beyond that date is uncertain. I plan to do at least one more release to wrap up things, but that'll need some more time to decide what drivers to include (not). Second, I have created a paypal account paypal@feyrer.de, if you want to donate money, buy me a pizza or coke or just SUPPORT FREE SOFTWARE, do so! (Judging by the feedback I got both in personal mail and in public forums, g4u seems to be a major alternative to some commercial products these days. I'd be happy if the people using it could give some money back to make it possible to continue working on the project! Yes, this is a plea for help!)
    1.12 Fix broken dd commmand ("out of memory!"). [20030820]
    1.11 New commands "uploadpart" and "slurppart" to save and restore partitions. Partition information is not changed and taken from MBR. Command 'disks' to list disks found, command 'parts' to list (BSD!) partitions on a given disk (wd0, ...). "uploaddisk" now has a default of rwd0d.gz for the imagename, so just "uploaddisk server" should work (just as "slurpdisk server" does already). [20030819]
    1.10 Bugfix release: make "GZIP=1 uploaddisk ..." work properly; document how to use a different account than 'install'. Document how to get the image size down by filling unused disk blocks with zero-bytes. [20030603]
    1.9 Maintenance update for NetBSD-current as of today; "dmesg" is now page-wise (|more); "disks" lists disks recognized on boot; allow setting GZIP=-1 to get lower compression; increased NMBCLUSTERS for usb2ethernet; Cloning from local disk to local disk with "clonedisk"; Lots of doc updates. [20030522]
    1.8 The Pumpkin Release! Sync with NetBSD 1.6. Now includes drivers for USB, RAID cards, Gigabit Ethernet and Token Ring. As a Halloween special, g4u now also comes as ISO image file in addition to a floppy image, so it can be booted from a CD instead of a floppy. Happy Halloween! :) [20021031]
    1.7 Update to accomodate latest drivers and kernel features from NetBSD 1.5.2. Fixed download of the .fs files from the web server. Added documentation about disk sizes. [20010919]
    1.6 Maintenance release to use latest drivers from NetBSD 1.5.1. Due to increased size, the Token Ring driver was removed, sorry. Greeting message of g4u with instructions was improved a bit. Web site now has a copy of the kernel config, for documentation of supported device drivers. [20010516]
    1.5 This release adds support for easy cloning of SCSI disks by giving "sd0" as the third argument to slurpdisk and uploaddisk. Also, support for i386 and i486 CPUs was added. [20010515]
    1.4 Maintenance release. [20010306]
    Played with GIMP to create the Animation next to the TOC. Thanks to the XBill artists for the OS images! Various doc updates. [20010306]
    Updated the web page a bit to answer various questions on supported filesystems and operating systems I got. Also add TOC. [20010305]
    1.3 Another bugfix release. This should get to a working state soon (i.e. now) [20010302]
    1.2 Bugfix release, the ramdisk was busted so that many commands just didn't work (ftp, ...) [20010301]
    1.1 First public release, updated to NetBSD 1.5 [20010228]
    1.0 Internal version based on NetBSD 1.4 that's been in use for two years in internal operation.

10. Copying, licenses & donations

    No license fees are requested except for military and related uses, commercial (re)sale, optional commercial licenses are available, and donations are always welcome! You can send money via paypal or buy me a book from my Amazon wishlist, as many of the people who have donated so far did - Thank you very much!

    g4u is distributed under the standard BSD license:

    /*
     * Copyright (c) 1999-2017
     *	Hubert Feyrer . All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     * 1. Redistributions of source code must retain the above copyright
     * notice, this list of conditions and the following disclaimer.
     * 2. Redistributions in binary form must reproduce the above copyright
     * notice, this list of conditions and the following disclaimer in the
     * documentation and/or other materials provided with the distribution.
     * 3. All advertising materials mentioning features or use of this software
     * must display the following acknowledgement:
     *	This product includes software developed for g4u by Hubert Feyrer
     * 4. Neither the name of the author nor the names of its contributors
     * may be used to endorse or promote products derived from this software
     * without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     * SUCH DAMAGE.
     */
    

This page has been accessed 3576154 times since last reset of the counter.
$Id: index.template,v 1.108 2018年12月11日 23:03:08 feyrer Exp $ Copyright (c) 1999-2017 Hubert Feyrer

AltStyle によって変換されたページ (->オリジナル) /