Re: quickly partition disk, copy an image, install grub

From: Gregory Seidman (gsslist+debian_at_anthropohedron.net)
Date: 09/20/05

  • Next message: Patrick Rittich: "Re: What can I do with six new publicly available computers? now nis vs. rsync"
    Date: Tue, 20 Sep 2005 11:49:25 -0400
    To: debian-user@lists.debian.org
    
    

    On Tue, Sep 20, 2005 at 09:20:33AM -0400, Matt Price wrote:
    } Hi,
    }
    } I have to install ubuntu or something similar on about 20 aging
    } workstations without cd drives. THese are donated boxes with small hard
    } drives (as small as 2.1 gig, but not all identical) all wiped clean.
    }
    } my thought is: do a workstation install of ubuntu on one drive and get
    } it all cleaned up the way I want it; shrink the partition down to a
    } minimum size to avoid copying lots of empty sectors; make a disk image
    } with dd; shutdown, install a second drive;and then:
    }
    } fdisk /dev/hdb, and set up / and swap partitions
    } mkswap /dev/hdb5 # do I need to do this?
    } # Do I need to create an e2fs fs on /dev/hdb1?
    } dd if=/path/to/image of=/dev/hdb1 # will this work if the partitions
    } # are not of exactly equal size?
    } dd if=/dev/hda of=/dev/hdb bs=448 count=1 # does this install GRUB?
    }
    } so, my question is: is this the right way to go about this? am I
    } missing any steps? is there a better way to do it?

    First off, if you're asking on a Debian list you should be talking about
    Debian rather than Ubuntu. Based on the following assumptions:

    1) You can find the smallest disk you will have to install on.

    2) You will have some partition (/home? something else?) that should grow
       to fill the remaining disk space on larger disks.

    3) You will be using a filesystem that supports growing, such as ext3.

    4) You can put all of these machines on a network together.

    5) You have a spare machine to use as "machine B" below.

    6) The various machines' disks are /dev/hda and they can all boot from CD.

    ...here's what I'd do:

    1) Do a full install and configuration on the machine (A) with the smallest
       disk. Configure everything, including partitions and swap, the way you
       want it. Make sure the partition that will be grown to fill the larger
       disks is the last partition.

    2) On each filesystem (not swap) dd if=/dev/zero of=zeroes until it runs
       out of room, then remove the file of zeroes. This is important for
       compression, which comes later.

    3) Set up a machine (B) with a network connection to your newly installed
       box so that it is listening on some TCP port, say 2000, for a network
       connection and will take any data from a connection and put it in a
       file. It should also be listening on another TCP port, say 3000, to
       which it will respond with the contents of the same file. I recommend
       using socket or netcat (nc) for this. I prefer socket, so my examples use
       socket:

       socket -r -q -p 'dd of=/tmp/diskimg.gz' -s 2000 &
       socket -w -q -p 'dd if=/tmp/diskimg.gz' -s -l 3000 &

    4) Reboot machine A with Knoppix or your favorite LiveCD. Tell it not to
       find any swap partitions.

    5) dd if=/dev/hda | gzip -c | socket -w -q MachineB 2000

    6) Boot each of the other machines, in turn, with a LiveCD.

    7) socket -r -q MachineB 3000 | gzip -d | dd of=/dev/hda

    8) use parted to grow the last partition (or fdisk to delete it and create
       it again to fill the disk), then use resize2fs (or the command
       appropriate to your chosen growable filesystem) to fill the now larger
       partition

    Note that the gzip in step 5 compresses all those nice zeroes you put on
    the disk in step 2 so that the data that goes over the network is
    minimized. This won't be incredibly speedy, but you should be able to
    perform step 7 on all of your machines in parallel. You may also want to
    set the bs parameter on the various dd commands.

    } thanks much,
    } matt
    --Greg

    -- 
    To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: Patrick Rittich: "Re: What can I do with six new publicly available computers? now nis vs. rsync"

    Relevant Pages

    • Re: Loaded SP2 now Im in a boot loop...Things to try.
      ... and missed that it would load XP on the highlighted partition. ... had windows install the driver off of the creative ... Windows only cares about windows getting on my drive.. ... then I will swap the drives.. ...
      (microsoft.public.windowsxp.general)
    • Windows on Mac - how to.
      ... No-nonsense instructions for those "in the know". ... A custom slipstreamed CD is required to install XP on a Mac. ... This procedure WILL WIPE YOUR iMAC DISK CLEAN. ... Partition the disk in two using the OSX CD: ...
      (uk.comp.sys.mac)
    • Re: xp on intel Mac from usb stick?
      ... Would it be possible to run windows xp native from a usb stick? ... A custom slipstreamed CD is required to install XP on a Mac. ... partition managers but if you're feeling adventurous you may ... This procedure WILL WIPE YOUR iMAC DISK CLEAN. ...
      (comp.sys.mac.apps)
    • Re: XP and Fedora on HP
      ... >> option to partition the disk to install the Linux. ... > Because you have two drives, the best approach is to install your Windows ...
      (comp.os.linux.setup)
    • Re: A Dual-boot question; I thought C was always the partition with the running OS
      ... The Server 2003 will then call its partion "C:" Local Disk. ... When Server 2003 starts up, it will call itself "C:" and it will call the WinXP partition "E:", but again, who cares? ... The OS then assigns drive letters to the first primary partition recognized on each successive hard disk. ... Because they're on separate hard drives, ...
      (microsoft.public.windowsxp.setup_deployment)