LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-28-2005, 12:37 PM   #1
onmountain
LQ Newbie
 
Registered: Oct 2005
Distribution: Debian
Posts: 16

Rep: Reputation: 0
What is best way to ghost an entire partition


Hi. This is what I want to conceptually accomplish. I have two identical servers - one called production, the other called test.
(1) I want to try apt-get update and other software patching and configuration changes on test, to make sure it works correctly.
(2) I then want to "ghost" the partition with all the files and config changes into some kind of image file of some sort
(3) I then want to be able to transfer this using a script from the production box using ftp? Maybe a cron job that checks and downloads any new tested update?
(4) ONce on the prouction box, this image file will need to be written onto an awaiting "empty" partition, then grub or lilo changes written so that the box reboots using the "new" version of the system.
(5) Final wish list idea - the programs running on the server (a CMS website) all write/read the databases and files on a /data partition, and this does not get overwritten. In effect, the system files and applications get updated with patches and stuff, but the data stays the same.

I appreciate any ideas on how to do this effectively
 
Old 10-28-2005, 02:43 PM   #2
onmountain
LQ Newbie
 
Registered: Oct 2005
Distribution: Debian
Posts: 16

Original Poster
Rep: Reputation: 0
I am trying this in newbie section

I have changed thsi question over to the newbie section...http://www.linuxquestions.org/questi...hreadid=377830
 
Old 10-28-2005, 02:51 PM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
First, that's called double posting and second, I can't imagine why you think an advanced topic like that has a better chance with the newbies.
 
Old 10-28-2005, 03:08 PM   #4
onmountain
LQ Newbie
 
Registered: Oct 2005
Distribution: Debian
Posts: 16

Original Poster
Rep: Reputation: 0
Sorry, I am not trying to break any rules. I am not sure how difficult my question really is. I started playing with dd command, but now I am all confused about if I am picking up the MBR along with the partition I am trying to copy, and if so, does it mess up my booting?
 
Old 10-28-2005, 03:24 PM   #5
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Rep: Reputation: 33
I use a program called Mondo to do this. It's a open source software that clones your system, ostensibly for backup purposes. It's really quite easy if you follow the steps in the how to. Of course you will need access to a CD burner, network drive, or Zip drive or something.

http://www.mondorescue.org
 
Old 10-28-2005, 04:51 PM   #6
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHEL, AltimaLinux, Rocky
Posts: 1,151

Rep: Reputation: 46
Quote:
Originally posted by onmountain
...I started playing with dd command, but now I am all confused about if I am picking up the MBR along with the partition I am trying to copy, and if so, does it mess up my booting?
onmountain: If you are using dd as is shown in the following example and the destination drive (hdb) is at least as large as the source drive (hda), then you are copying everything, including the MBR.

dd if=/dev/hda of=/dev/hdb bs=64M

The hdb drive in this example will be a clone of the hda drive. You could remove hdb and substitute it for hda and the system would boot as before.

Please note that no partitions from either drive should be mounted during the transfer.
 
Old 10-28-2005, 05:39 PM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
The dd command is an excellent tool to mirror an identical image including the boot loader. However it is only good if

(1) Both the target and source partitions are identical in size.

(2) To a lesser extent the partition number of both source and target should be ideally indentical too. i.e. from a hda6 to a sdb6.

Different partition numbers can be overcome by altering the partition number in the boot loader and /etc/fstab.

If the source and target partitions are diffierent in size the tar command is the best and produces a 100% copy. Assuming the source is /mnt/hda6 and the target is sdb6, just cd to /mnt/hda6 and type

tar cf - . | (cd /mnt/sdb6; tar xf -)

WhatsHisName suggested whole disk copy, with bs=64M, is also a sure fire method if both disks are identical in size. Haven't tried to use a larger target disk yet myself.
 
Old 10-29-2005, 08:18 AM   #8
onmountain
LQ Newbie
 
Registered: Oct 2005
Distribution: Debian
Posts: 16

Original Poster
Rep: Reputation: 0
Would the tar command only copy the files that exist, verses the dd command copying the entire partition? If so, I would assume then that the tar would produce a smaller file size? I noticed that the dd command creates a 3GB file if the source partition is 3GB, even if the partition contained only a 2kB text file. The tar output would be potentially a better candidate if I wanted to eventually ftp this stuff around between machines? Or can I compress and decompress the output of dd?
 
Old 10-29-2005, 11:47 AM   #9
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
dd copies the native information, in 1s and 0s, and therefore the entire partition is mirrored faithfully. Thus Linux can't write on a NTFS partition it can still dd a XP NTFS partition and has it bootable. There is no compression used in the dd command and the empty spaces are mirrored same as the stored data, but possibly faster.

Tar command retains the full structure of the filing systems (permissions, ownership etc) but doesn't copy the boot sector. The user has to replicate the boot sector separately afterward. The boot loader can be replicated by grub-install or lilo -b on the raw device /dev/hdax, where x is the partition number.

I move bootable Linux partitions between hard disks and also between machines. I would use dd first and tar as the second alternative only if I alter the partition size.

Both are reliable methods for moving "bootable" partitions.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete an entire partition john8675309 Linux - Software 1 02-02-2005 08:57 PM
Sharing an entire partition for RW access darkdonno Linux - Networking 1 11-20-2004 09:40 AM
Backing up entire Linux System (partition) podollb Linux - Software 4 10-14-2003 10:01 PM
taking image of entire partition. noname Linux - Software 4 05-14-2002 11:51 PM
ghost partition frieza Linux - Hardware 1 04-30-2002 04:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:36 PM.

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