LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-16-2008, 04:19 AM   #1
shahin123
Member
 
Registered: Mar 2008
Posts: 43

Rep: Reputation: 15
image question


Hi,

could some one tell me, how can I create and install an image of my debian tech system? I did install debian on a box, and install all the softwares that we need, and configure it for our needs, now we want to make an image of this box and install it on 20 more computers, I heard some softwars like g4u or g4l, but if i understand it good these tools cloon the hard drive and it take a long time to do so, and if the image above 2 gb there is a chance that some thing goes wrong.

Thanks,

Shahin
 
Old 04-16-2008, 05:07 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
How much free space is available on the partitions? If you have 2 GB of used space on much larger drives, you could pipe the output of dd through gzip or bzip2. If the drive isn't new, then you will want to zero out the unused areas of the partition so that they compress better.

You will need to perform some fixing up on the other hosts. Some items like /etc/hosts or /etc/HOSTNAME will need to be different on each machine. I think that the model you clone should use the hostname "localhost.localdomain" and then change it after writing the image. This is to prevent several computers on the network from having the same hostname. There may be other items that need to be altered however that I haven't thought of. The partitions mentioned as sharable in the Linux Filesystem Hierarchy Standard should be able to be cloned without any problem.

Are the other computers of the same make and model? If not, then you may need to modprobe different kernel modules for the hardware to work and maybe even maybe edit /etc/modprobe.conf and remake your initrd file.

Last edited by jschiwal; 04-16-2008 at 05:15 AM.
 
Old 04-16-2008, 06:45 AM   #3
shahin123
Member
 
Registered: Mar 2008
Posts: 43

Original Poster
Rep: Reputation: 15
HI,

thanks for replay,

the OS is installed on one drive and it used 2.3 gb of this drive, I want to create a image of this drive. all the PC's have the same hardware.

so what would be the fastes way to cloon the drive with os to each of othere drives? or create a image of the first drive (the one with os) and restore it on othere PC's?

Which software would be good for me?

Thanks again,

Shahin
 
Old 04-16-2008, 02:05 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
You can use the dd command to copy the images. You can also use the same command to fill the drive with a file containing only zeros, and then delete the file. After doing this the compressed file will be close to 2GB.

Here is an example where I cleared out the free space of my /boot partition:
df /dev/sda1
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 155543 24602 122911 17% /boot
jschiwal@hpmedia:~> dd if=/dev/zero of=/boot/zerofile bs=1024 count=122910
jschiwal@hpmedia:~> sudo dd if=/dev/zero of=/boot/zerofile bs=1024 count=122910

I used the same block size (bs) in the dd command as the df command used. I subtracted 1 from the results to leave room for a slightly larger directory file if need be. Next, I deleted /boot/zerofile. Its job is done.

Now I can create a compressed image file:
sudo dd if=/dev/sda1 bs=1024 | gzip -9 >/media/mb2/boot.img.gz

I saved the image to an external drive. A network share could have been used instead. Because the image file is under 4.7 GB, you could latter burn the file to a DVD as well. Restoring the image would be the reverse process (as the root user).
zcat /media/mb2/boot.img.gz | dd of=/dev/sda1 bs=1024

This could be done with a drive device as well. Just use /dev/sda instead of /dev/sda1 for example. The zerofile would need to be created/delete on each partition however.

The dd command is one of the files supplied by the core-utils package so you are sure to have it.

Last edited by jschiwal; 04-16-2008 at 02:08 PM.
 
Old 04-17-2008, 02:36 AM   #5
shahin123
Member
 
Registered: Mar 2008
Posts: 43

Original Poster
Rep: Reputation: 15
Hi jschiwal,


Thanks again for your replay, it has very useful info, could you tel me how long took you to create your image?

Thanks,

Shahin
 
Old 04-17-2008, 05:53 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
My boot partition was very small so I didn't have too long to wait. There is information in the dd info manual about signaling the dd process so that it outputs progress information on stderr.
Code:
dd if=/dev/zero of=/dev/null count=10MB & pid=$!
     $ kill -s SIGUSR1 $pid; wait $pid
If it takes too long for you, you could try using a different compression level in the gzip command. My example used the maximum.

Last edited by jschiwal; 04-17-2008 at 05:57 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel-image question Oh Cisco Debian 2 01-21-2005 02:46 PM
Question on CD Image extractor bbmak Linux - Software 1 10-25-2004 09:17 PM
CD Image Question aaa Linux - General 7 09-22-2003 12:03 PM
image viewer question jkcunningham Linux - Software 9 07-16-2002 03:49 PM
part image question ronen Linux - Software 4 05-09-2002 05:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration