[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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

On Tue, Sep 20, 2005 at 11:49:25AM -0400, Gregory Seidman wrote:
> 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.

But see OP message above. They don't have 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

Paul E Condon           

Reply to: