LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Create an .iso image (https://www.linuxquestions.org/questions/linux-software-2/create-an-iso-image-199532/)

bentman78 06-30-2004 12:25 PM

Create an .iso image
 
Hello,
How do I create an .iso image or any image from the OS I have. I have just installed a FreeBSD server and complied all the software from source, and as one can imagine, compling everything takes a long time. I want to create a snapshot image for the server because I want to install this exact same configuration on my other server. The reason I ask this here is because I have a Linux server I want to do the same thing for and I'd assume the procedures will be very similar. This way I can stick in the CD and have it install all the software configured the way I have it now on any other server I want to without having to go through the long process of comling everything from source again. Thanks in advance.

Shade 06-30-2004 01:24 PM

Are you planning on creating a bootable cd, or just an archive of your compiled programs?

My suggestion would be to do a normal install fromthe fBSD discs, and create packages from your compiled programs.
Put those compiled programs on the disc and install them like normal.

You could make a snapshot of the entire system if you like as well, but I'd start from a fresh install and create a template like that.

man mkisofs :)

--Shade

Electro 06-30-2004 03:40 PM

Using mkisofs will not keep permissions, so you may want to use tar. With tar, permissions are kept and you can make a fixed size.

RagingIfrit 06-30-2004 03:49 PM

To create a bootable cd I use Nero Burning ROM, which I believe has a basic version for downloading. Simply go to compile new cd/image cd/ and select your file. You can also create one using, I believe, Kwrite in KDE. Right click on the iso and chose create with Kwrite

jschiwal 06-30-2004 05:03 PM

If you want to create an image file of a partition, us the dd command, with the if= argument being the mounted device such as if=/dev/hda1 or even /dev/hda. You will need enough space on the output file-system to store it of course. Using an external usb drive would be handy for this. If you were copying the image to identical machines you could boot up to a rescue disk or a live distro and use the dd command the other way. You will need to give each machine unique host names and ip addresses if they are on a network.

If you have a large number of machines that you want to set up, check out the web site of the distro you are using. They have centralized installation methods that you could base your solution on.

You may want to look at the man page for the tar command. They have examples near the end of using the tar command to copy directories of infomation from one machine to another. If you pre-partition the target machines, you could boot them with a rescue disk or a live distro disk and use this method to populate the partitions you need to.

Cerbere 07-01-2004 03:57 AM

Quote:

Originally posted by Electro
Using mkisofs will not keep permissions, so you may want to use tar. With tar, permissions are kept and you can make a fixed size.
Electro, mkisofs will preserve file permissions if you use the -R flag. The following is from the mkisofs man page:
Code:

      mkisofs is capable of generating the  System  Use  Sharing
      Protocol records (SUSP) specified by the Rock Ridge Inter-
      change Protocol.  This is used  to  further  describe  the
      files  in  the iso9660 filesystem to a unix host, and pro-
      vides information such as longer filenames, uid/gid, posix
      permissions,  symbolic links, block and character devices.

Code:

      -R    Generate SUSP and RR records using the  Rock  Ridge
              protocol  to  further  describe  the  files  on the
              iso9660 filesystem.

That being said, I agree that tar would be a better solution.

bentman78, execute the following commands:

cd /
tar -cf filesystem.tar bin/ boot/ dev/ etc/ home/ lib/ mnt/ opt/ root/ sbin/ tmp/ usr/ var/
gzip filesystem.tar

Note that you don't include the /proc/ directory. You will now have a file called filesystem.tar.gz which you can burn to a CD just like any other file. Then you can boot your target machine with a rescue disk (I like Tom's root/boot); fdisk, format, and mount the target disk; mount your CD; copy, unzip, and untar the file system to the target disk. Now just chroot and run lilo, and your new system should be ready to boot.

Another (simpler) solution would be to physically install the drive from your target system into your existing system; fdisk, format, and mount it; then run the following commands:

cd /
cp -a bin boot dev etc home lib mnt opt root sbin tmp usr var /mnt/point/of/newdrive/

Then re-install the drive in your new system, boot with Tom's, then chroot and run lilo.

Though the second solution is simpler, the first will provide a nice portable, (semi-)permanent back-up of your shiny, new system. Personally, I don't trust CD-Rs to last, so I copied my latest LFS system to an old 2GB HDD as a back-up. The choice is yours.

Enjoy!
--- Cerbere

bentman78 07-01-2004 08:40 AM

Thank you everyone for your help. I think tar would be the best option since I want to retain file permissions. But will it keep my current file configurations as well, for example my httpd.conf file and all the modules I have compiled into apache?

macleo 07-01-2004 09:37 AM

man mkisofs

Cerbere 07-01-2004 10:49 PM

Yes bentman78, tar will preserve all your files as well as their permissions/ownerships. This will include all your configuration files, so whatever settings you have for apache, etc. will be preserved.

It will create a file which contains all the files from your current system (which is why you don't want to include the /proc directory). This will be at least as big as the total size of all files on your system, so you want to be sure you have enough free space. Check this by running the 'df' command. You can compare the used space to the available space. This is also why you want to compress the tar file with the gzip command.

One other tip:
If you use Tom's root/boot to uncompress/extract your filesystem, you will have to do this in two steps:

gzip -d filesystem.tar.gz
tar -xvf filesystem.tar

because the 'tar' command on Tom's doesn't accept the 'z' option to unzip.

Enjoy!
--- Cerbere

hw-tph 07-02-2004 05:22 AM

For easy backing up parts (or all) of the system to CDR's I suggest you look into Mondo Rescue. There is a FreeBSD port available.


Håkan


All times are GMT -5. The time now is 08:52 PM.