<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Libre Things &#187; gparted</title>
	<atom:link href="http://positon.org/tag/clone-a-linux-system-install-to-another-computer/feed" rel="self" type="application/rss+xml" />
	<link>http://positon.org</link>
	<description></description>
	<lastBuildDate>Tue, 23 Feb 2016 20:01:11 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>Clone a Linux system install to another computer</title>
		<link>http://positon.org/clone-a-linux-system-install-to-another-computer</link>
		<comments>http://positon.org/clone-a-linux-system-install-to-another-computer#comments</comments>
		<pubDate>Sun, 06 Apr 2014 15:54:06 +0000</pubDate>
		<dc:creator><![CDATA[dooblem]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gparted]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://positon.org/?p=159</guid>
		<description><![CDATA[After searching a bit I could not find a simple and good howto to do that. The following method should work for any Linux distribution (Ubuntu, Debian, Manjaro, Archlinux, Fedora&#8230;). Source and target systems must be on the same processor architecture (though transfer from 32bit to 64bit should work). What you need: 2 live USB [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>After searching a bit I could not find a simple and good howto to do that.<br />
The following method should work for any Linux distribution (Ubuntu, Debian, Manjaro, Archlinux, Fedora&#8230;). Source and target systems must be on the same processor architecture (though transfer from 32bit to 64bit should work).</p>
<p>What you need:</p>
<ul>
<li>2 live USB keys (or cds)</li>
<li>To speed up data transfer: good quality ethernet cables (one cable between the 2 computers is OK), or a usb key/drive with a BIG ext4 partition. You can try over wifi, but it may be slow.</li>
</ul>
<h3>1. Boot source and target machines on live USB/CD</h3>
<p>Any live USB/CD should be OK.<br />
On the target computer, you will need a tool to partition your hard drive, like <a href="http://gparted.org/" title="gparted">gparted</a>.<br />
<a href="http://rsync.samba.org/" title="rsync">rsync</a> is also required for data transfer: it&#8217;s included in many live systems.</p>
<p><a href="http://www.ubuntu.com/" title="Ubuntu">Ubuntu</a> live cd is OK, <a href="http://manjaro.org/" title="Manjaro">Manjaro</a> live cd too.</p>
<h3>2. Partition your target hard drive</h3>
<p>Use a tool like <a href="http://gparted.org/" title="gparted">gparted</a> to partition the target hard drive, with the same partitions as your source system (slash, swap, home&#8230;).<br />
I recommend you to assign LABELs to your partitions: for the fstab, it&#8217;s easier than UUIDs.</p>
<h3>3. Mount all partitions on both machines</h3>
<p>On both systems, open a root terminal. Then, for each data partition (you can ignore swap):</p>
<pre>
mkdir /mnt/slash
mount /dev/sdaX /mnt/slash
</pre>
<p>If you have a home partition:</p>
<pre>
mkdir /mnt/home
mount /dev/sdaY /mnt/home
</pre>
<h3>4. Transfer the data (network or usb)</h3>
<p>This part may be tricky. Choose the method you prefer.</p>
<h4>Network</h4>
<ol>
<li><strong>Setup the network.</strong> Test the connectivity with ping command.<br />
The easier is to plug the PCs on a DHCP network (like your ISP box) so that you get automatic IP addresses. If you linked the 2 pcs with a single cable, you&#8217;ll have to setup the IPs with NetworkManager (static ips, or adhoc network).</li>
<li>On source system, as root, create a simple <code>/etc/rsyncd.conf</code> file:
<pre>
uid = root
gid = root
use chroot = no

[all]
    path = /
</pre>
</li>
<li>Then start the rsync daemon server: <code>rsync --daemon</code></li>
<li>On target PC, for each partition:
<pre>
rsync -avHX SOURCE_IP::all/mnt/slash/ /mnt/slash/
</pre>
<p>Don&#8217;t forget &#8216;/&#8217; at the end of paths. <code>-a</code> will preserve many file attributes like owner and permissions, <code>-H</code> will preserve hardlinks if any, <code>-X</code> will preserve extended attributes like setuid. You may also add <code>-A</code> if you are using acls. What is good with rsync is that you can stop and restart the transfer whenever you want.
</li>
</ol>
<h4>USB</h4>
<p>Prepare a USB drive with a BIG ext4 partition.</p>
<ol>
<li>Mount the USB partition on source system (<code>mount /dev/sdbX /mnt/usb</code>)</li>
<li>For each partition:
<pre>
rsync -avHX /mnt/slash/ /mnt/usb/slash/
</pre>
</li>
<li>umount, unplug and remount the USB disk on the target system.</li>
<li>For each partition:
<pre>
rsync -avHX /mnt/usb/slash/ /mnt/slash/
</pre>
</li>
</ol>
<h3>5. Change fstab on target system</h3>
<p>As root, edit <code>/mnt/slash/etc/fstab</code><br />
For each partition (including swap), replace the first field with the new UUID or LABEL (it&#8217;s straightforward with LABELs):<br />
<code>UUID=the-long-uuid</code>, or <code>LABEL=yourlabel</code></p>
<p>2 ways to get the UUIDs / LABELs:</p>
<pre>
ls -l /dev/disk/by-uuid/
blkid /dev/sdaX
</pre>
<h3>6. Reinstall Grub</h3>
<p>We will use a <strong>chroot</strong> (changed root environment) to be able to call the <a href="http://www.gnu.org/software/grub/" title="Grub">grub</a> install inside the migrated system.</p>
<p>First, bind mount some system directories needed by grub, then chroot:</p>
<pre>
mount --bind /proc /mnt/slash/proc
mount --bind /sys /mnt/slash/sys
mount --bind /dev /mnt/slash/dev
mount --bind /run /mnt/slash/run
chroot /mnt/slash
</pre>
<p>Then install grub in the <a href="http://en.wikipedia.org/wiki/Master_boot_record" title="master boot record">Master Boot Record</a> of your hard drive, and update grub config file (with the new uuids&#8230;):</p>
<pre>
grub-install /dev/sda
update-grub
</pre>
<h3>7. Reboot target machine</h3>
<p>That&#8217;s it! Your system should be working on the new computer now.<br />
Feel free to comment if you encounter problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://positon.org/clone-a-linux-system-install-to-another-computer/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
