<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bert23</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bert23"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Bert23"/>
	<updated>2026-05-16T20:59:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_copy_a_Linux_installation&amp;diff=37215</id>
		<title>How to copy a Linux installation</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_copy_a_Linux_installation&amp;diff=37215"/>
		<updated>2008-03-30T15:09:10Z</updated>

		<summary type="html">&lt;p&gt;Bert23: /* Using tar to make a copy of the filesystem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Using dd to make a 1:1 copy ==&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
When dd is used to create the copy, it is copied at a sector by sector level.  This means that in many circumstances, the new version will have it's boot sector set up and everthing.  In situations where you are making a complete copy of the disk, even things like the IBM tools and your windows partition will be saved.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
Because dd copies sector by sector it copies everything, including sectors that aren't allocated.  This makes it a longer process.  To update the backup copy, it must perform the whole process again, rather than simply updating the things that have changed.&lt;br /&gt;
&lt;br /&gt;
=== Case 1: The Linux installation is on a separate Harddisk ===&lt;br /&gt;
&lt;br /&gt;
This method works if you can put wo drives in your laptop.&lt;br /&gt;
Best to boot from a boot disk, so that the contents of the disks are not changed during the cloning.&lt;br /&gt;
&lt;br /&gt;
dd if=/dev/hd[a,b,c,..] of=/dev/hd[a,b,c,..] bs=2M&lt;br /&gt;
&lt;br /&gt;
Part of Sourcedrive       : if=/dev/hd[a,b,c,..]  the Letter &amp;quot;a&amp;quot; for the first Harddrive, b for the second, ....&lt;br /&gt;
&lt;br /&gt;
Part of Destinationdrive  : of=/dev/hd[a,b,c,..]  the Letter &amp;quot;a&amp;quot; for the first Harddrive, b for the second, ....&lt;br /&gt;
&lt;br /&gt;
=== Case 2: The Linux installation is on a Partition ===&lt;br /&gt;
&lt;br /&gt;
(e.g. hda1 is the Partition with the Linux installation and hdb1 is the Destinationdrive)&lt;br /&gt;
&lt;br /&gt;
dd if=/dev/hda1 of=/dev/hdb1 bs=2M&lt;br /&gt;
&lt;br /&gt;
=== Case 3: Copying whole disk ===&lt;br /&gt;
&lt;br /&gt;
Case 1 assumes you can put two drives in your laptop.&lt;br /&gt;
The method here can be used when you have access to a networked computer with a lot of space. Or, when you have an external 3.5 HD.&lt;br /&gt;
(If you have a 2.5 external USB drive you can use [[Harddrive_Upgrade]])&lt;br /&gt;
&lt;br /&gt;
1) Boot from a CD, such as R.I.P.&lt;br /&gt;
&lt;br /&gt;
2a) dd if=/dev/hda bs=65536 conv=noerror,sync |gzip -c| ssh somewhere-with-disk&lt;br /&gt;
&lt;br /&gt;
Or, with external drive, mount it on /mnt/usb&lt;br /&gt;
&lt;br /&gt;
2b) dd if=/dev/hda bs=65536 conv=noerror,sync |gzip -c &amp;gt; /mnt/usb/big_file&lt;br /&gt;
&lt;br /&gt;
The gzip will cause a compression of the image file, hope for about 2:1 compression, but prepare for worse!&lt;br /&gt;
&lt;br /&gt;
3)Replace your old drive with new drive, and boot again from the CD.&lt;br /&gt;
Restore with:&lt;br /&gt;
&lt;br /&gt;
4a) ssh somewhere-with-disk cat rawdisk.img|gzip -dc|dd of=/dev/hda bs=65536&lt;br /&gt;
&lt;br /&gt;
Or, for the external drive&lt;br /&gt;
&lt;br /&gt;
4b) cat /mnt/usb/big_file |gzip -dc|dd of=/dev/hda bs=65536&lt;br /&gt;
&lt;br /&gt;
You can change the partition information after the restore with tools such as parted.&lt;br /&gt;
Note, on very old drives this method might fail when the drives are not fully identical, as the geometries needed to be equal. &lt;br /&gt;
However, there is no risk of data loss, just re-insert the old drive and try another method.&lt;br /&gt;
&lt;br /&gt;
== Using tar to make a copy of the filesystem ==&lt;br /&gt;
&lt;br /&gt;
=== How to ===&lt;br /&gt;
* point your console to the place you would like to copy (copying from a running system root might cause problems), like:&lt;br /&gt;
  #cd /&lt;br /&gt;
&lt;br /&gt;
  or do it saver like: &lt;br /&gt;
  #cd /path/to/mountpoint&lt;br /&gt;
* do this to clone the current partition to another:&lt;br /&gt;
  #tar cf - . | (cd /path/to/mountpoint; tar xf -)&lt;br /&gt;
&lt;br /&gt;
  to get some information about the progress add the &amp;quot;v&amp;quot; for verbose mode&lt;br /&gt;
  #tar cfv - . | (cd /path/to/mountpoint; tar xf -)&lt;br /&gt;
&lt;br /&gt;
  in case your getting an error, that files/directories can't be created or read try this:&lt;br /&gt;
  #sudo tar cfv - . | (cd /path/to/mountpoint; sudo tar xf -)&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
* able to restore it to another filesystem&lt;br /&gt;
* incremental backups&lt;br /&gt;
* burn splitted backups on dvd&lt;br /&gt;
* compression (if you save it to a file)&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
* Does not back up the boot sector and MBR, so you will need to rerun [[grub]] or [[LILO]].&lt;/div&gt;</summary>
		<author><name>Bert23</name></author>
		
	</entry>
</feed>