<h2 id="converting-my-laptop-to-dual-boot">Converting My Laptop to Dual Boot</h2>
<h3 id="summary">Summary</h3>
<p>In this episode I describe how I converted my Linux-only laptop to dual-boot with Windows 10. Specifically, using information from a previous HPR episode.</p>
<h3 id="reference">Reference</h3>
<p>The procedure used in this project drew heavily from the information presented in HPR episode <a href="https://hackerpublicradio.org/eps.php?id=2305">2305</a> by Mongo.</p>
<h3 id="target-laptop">Target Laptop</h3>
<ul>
<li>Lenovo Thinkpad T550</li>
<li>Intel i7-5600U Dual-Core</li>
<li>8GB RAM</li>
<li>256GB SSD</li>
</ul>
<p>Laptop was purchased in Jan 2016 as a factory refurb unit from an Ebay seller. The model was about 1 year old at the time. As soon as I got it, I summarily removed any trace of Windows, with prejudice, and installed Linux.</p>
<h3 id="the-problem">The Problem</h3>
<p>I am needing to run some Windows software that doesn't work in either Wine or a virtual machine environment. Specifically Autodesk Fusion 360.</p>
<h3 id="some-challenges">Some Challenges</h3>
<ul>
<li><p>No longer have Windows install media. I was able to download a Lenovo recovery USB image.</p>
<p><a href="https://support.lenovo.com/us/en/solutions/ht103653" class="uri">https://support.lenovo.com/us/en/solutions/ht103653</a></p></li>
<li><p>I didn't think that a 256GB drive would be big enough for both Linux and Windows. I purchased a 512GB SSD drive.</p></li>
<li><p>I was happy with my Xubuntu setup and configuration and didn't want to have to start all over on that. I hoped that restoring my home directory would take care of that.</p></li>
</ul>
<h3 id="the-procedure">The Procedure</h3>
<ol type="1">
<li><p>Backed up my home directory, just in case.</p></li>
<li><p>Replaced the hard drive.</p></li>
<li><p>Tried to boot from Lenovo Windows thumb drive.</p></li>
<li><p>Found that the BIOS was set to legacy mode, so reset BIOS to factory.</p></li>
<li><p>Told the installer to use the entire drive.</p></li>
<li><p>Went through the entire Windows install and update process.</p></li>
<li><p>Used the instructions provided by Mongo to resize Windows filesystem size.</p></li>
<li><p>Used the instructions provided by Mongo to turn of fast boot.</p></li>
<li><p>Used the instructions provided by Mongo to turn of Secure Boot in BIOS.</p></li>
<li><p>Booted from Xubuntu 16.04 thumb drive.</p></li>
<li><p>Did Xubuntu install as normal, choosing the install type of installing along side Windows Boot Manager.</p></li>
<li><p>Installed all of the updates.</p></li>
<li><p>Mounted the old hard drive with a USB drive enclosure, which was a bit of a challenge because that drive was encrypted. The drive has 2 partitions. A small boot partition and then a large LUKS encrypted partition.</p>
<p>This is a procedure that can be used to mount such a partition.</p>
<ul>
<li><p>First you must decrypt the partition and map it to a device. This can be done with the following command (assuming the partition mount point is /dev/sdb2):</p>
<pre><code>cryptsetup luksOpen /dev/sdb2 cryptdrive</code></pre>
<p>This command will map the partition to the following device:</p>
<pre><code>/dev/mapper/cryptdrive</code></pre></li>
<li><p>Normally you could then mount the filesystem as follows:</p>
<pre><code>mount /dev/mapper/cryptdrive /mnt</code></pre></li>
<li><p>However, in this case the encrypted filesystem is actually an LVM volume that contains two volume groups that made up the partitions of the previous Linux install, so you can't directly mount it.</p></li>
<li><p>I had to first install the LVM tools, which had not been installed by default.</p>
<pre><code>apt-get install lvm</code></pre></li>
<li><p>Then I had to issue the following command to activate the LVM volume groups.</p>
<pre><code>vgchange -ay</code></pre>
<p>That resulted in two more devices being created.</p>
<pre><code>/dev/xubuntu-vg/swap
/dev/xubuntu-vg/root</code></pre></li>
<li><p>I could then finally mount the old root filesystem with:</p>
<pre><code>mount /dev/xubuntu-vg/root /mnt</code></pre></li>
</ul></li>
<li><p>Copied by entire home directory from the old hard drive to the new install.</p>
<pre><code>cd /home
cp -rp /mnt/home/username .</code></pre></li>
<li><p>Rebooted computer and Xubuntu came up will all of my desktop settings intact. Just need to install non-default packages.</p></li>
</ol>
<h3 id="result">Result</h3>
<p>This ended up being a totally successful process. The computer is now dual-boot. It boots into Xubuntu by default, but you can choose Windows. Xubuntu system is mostly restored back to the way it was.</p>
