Site Administration Page 6 - Advanced Concepts on Dealing with Files and Filesystems in BSD |
Use an open source alternative to commercial ghosting software. Do you find yourself installing multiple systems, all containing the same operating system and applications? As an IT instructor, Im constantly installing systems for my next class or trying to fix the ramifications of a misconfiguration from a previous class. As any system administrator can attest to, ghosting or hard drive-cloning software can be a real godsend. Backups are one thing; they retain your data. However, an image is a true timesaver--it's a copy of the operating system itself, along with any installed software and all of your configurations and customizations. I haven't always had the luxury of a commercial ghosting utility at hand. As you can well imagine, I've tried every homegrown and open source ghosting solution available. I started with various invocations ofdd,gzip,ssh, anddump, but kept running across the same fundamental problem: it was easy enough to create an image, but inconvenient to deploy that image to a fresh hard drive. It was doable in the labs that used removable drives, but, otherwise, I had to open up a system, cable in the drive to be deployed, copy the image, and recable the drive into its own system. Forget the wear and tear on the equipment; that solution wasn't working out to be much of a timesaver! What I really needed was a floppy that contained enough intelligence to go out on the network and retrieve and restore an image. I tried several open source applications and found that Ghost For Unix,g4u, best fit the bill. Creating the Ghost Disk You're about two minutes away from creating a bootableg4ufloppy. Simply download g4u-1.12fs from http://theatomicmoose.ca/g4u/ and copy it to a floppy: # cat g4u-1.12fs > /dev/fd0 Your only other requirement is a system with a drive capable of holding your images. It can be any operating system, as long as it has an installed FTP server. If it's a FreeBSD system, you can configure an FTP server through /stand/sysinstall. Choose Configure from the menu, then Networking. Use your spacebar to choose Anon FTP. ChooseYesto the configuration message and accept the defaults by tabbing toOK. The welcome message is optional. Exitsysinstallonce you're finished. You'll then need to remove the remark (#) in front of the FTP line in /etc/ inetd.conf, so it looks like this: ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l Ifinetdis already running, inform it of the configuration change usingkillall -1 inetd. Otherwise, startinetdby simply typinginetd. To ensure the service is running: # sockstat | grep 21 In this listing, the local system is listening for requests on port 21, and there aren't any current connections listed in the remote address section (*:*). g4urequires a username and a password before it will create or retrieve an image. The default account isinstall, but you can specify another user account when you useg4u. To create theinstallaccount on a FreeBSD FTP server: # pw useradd install -m -s /bin/csh
Then, usepasswd installto give this account a password you will remember. Creating an Image Before you create an image, fully configure a test system. For example, in my security lab, I usually install the latest release of FreeBSD, add my customized /etc/motd and shell prompt, configure X, and install and configure the applications students will use during their labs. It's a good idea to know ahead of time how large the hard drive is on the test system and how it has been partitioned. There are several ways to find out on a FreeBSD system, depending upon how good you are at math. One way is to go back into/stand/sysinstalland chooseConfigurethenFdisk. The first long line will give the size of the entire hard drive: Disk name: ad0 Pressqto exit this screen. If you then typefdiskat the command line, you'll see the size of your partitions: # fdisk This particular system has a 9787 MB hard drive that has one 1999 MB partition containing FreeBSD.
Once you're satisfied with your system, insert the floppy and reboot. g4u will probe for hardware and configure the NIC using DHCP. Once it's finished, you'll be presented with this screen: Welcome to g4u Harddisk Image Cloning V1.12! Creating the image is as simple as invokinguploaddiskwith the IP address of the FTP server. If you wish, include a useful name for the image; in this example, I'll call the image securitylab.gz: # uploaddisk 192.168.2.95 securitylab.gz This will take a while. How long depends upon the size of the drive and the speed of your network. When it is finished, you'll see a summary: 9787+1 records in You can also check out the size of the image on the FTP server: % du -h ~install/securitylab.gz That's not too bad. It took just over an hour and a half to compress that 9 GB drive to a 3.7 GB image. Theg4uweb site also has some hints for further reducing the size of the image or increasing the speed of the transfer.
It's also possible to create an image of each particular filesystem, but I find it easier just to image a fairly small drive. This is because an image of the entire drive includes the master boot record (MBR) or the desired partitioning scheme. Deploying the Image When you wish to install the image, use the floppy to boot the system to receive the image. Once you receive the prompt, specify the name of the image and the IP address of the FTP server: # slurpdisk 192.168.2.95 securitylab.gz It doesn't matter what was previously on that drive. Since the MBR is recreated, the new drive will just contain the imaged data. Once the deployment is finished, simply reboot the system without the floppy.
See Also
blog comments powered by Disqus |
|
|
|
|
|
|
|