How to Boot Debian with UEFI on Lenovo M93p Tower

I just bought a ThinkCenter M93p for work.

I immediately took an image of the entire hardrive but to do that I had to get live booted linux distro.

Here's how I did it:

1. Create live disk 2. Use live disk, and copy disk to another machine, or external disk (I used my laptop). 3. Now install linux using UEFI Firmware based Distro.

Create Live USB Linux that Uses UEFI Firmware to Boot

Out of the box if you pick a distro that's UEFI compliant and that's most of them these days. CentOS, Ubuntu and Debian all do. For my purposes I elected to use a Ubuntu Live 14.04 LTS image.

I initially tried with a CentOS 6.5 i386 ISO but it never booted. I happened to see some where 32 bit images have UEFI boot issues. After that I tried using the Ubuntu Live DVD amd64 ISO. I went with the DVD because I had a feeling it would give me less firmware grief.

Grab the ISO and Download the torrent:

# Substitute with your choice in bittorrent clientwget \-O ubuntu64livedvd.torrent && \transmission-cli ubuntu64livedvd.torrent

Now we go ahead and make into an image using dd.

╔ǁ * ǁ 03:50 PM Fri Jul 11 ǁ 0 ǁ max@test ǁ ~ ǁ 30 files, 5.0M ǁ═╗╚═» sudo fdisk -lDisk /dev/sdc: 7803 MB, 7803174912 bytes255 heads, 63 sectors/track, 948 cylinders, total 15240576 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x7da64d7d   Device Boot      Start         End      Blocks   Id  System/dev/sdc1   *           0      483327      241664    0  Empty/dev/sdc2            3852        4683         416   ef  EFI (FAT-12/16/32)WARNING: GPT (GUID Partition Table) detected on '/dev/sdc1'! The util fdisk doesn't support GPT. Use GNU Parted.# notice I'm writing at the device level using of=╔ǁ * ǁ 03:50 PM Fri Jul 11 ǁ 0 ǁ max@test ǁ ~ ǁ 30 files, 5.0M ǁ═╗╚═» sudo dd if=$LIVEDISKISO of=/dev/sdc bs=4M

Now reboot the m93p, you shouldn't have to change the bios settings at all. I did have to update the BIOS from Lenovo's site from a January 2014 Release to FBKT75A. Install that using your preferred method.

Make sure secure boot is disabled, and you can disable CSM. If the F12 is allowed then hit that as the machine boots you might want to disable fastboot as well.

Prepare to Clone the Lenovo M93p Disk

You're going to do this in case you need to restore.

Now you can go ahead a Image of the entire disk. You might want to consider white washing your disk so you can save in compression by zeroing out the empty space on the disk and save it offline, full instructions.

# If you don't understand this in the instructions then, skip this step. You're making sure there's zeros the empty space of the device. mkdir image_sourcesudo mount /dev/sda1 image_sourcedd if=/dev/zero of=image_source/wash.tmp bs=4Mrm image_source/wash.tmpsudo umount image_source# Where sda is the name of the device, and 1 is the partition number. # Adjust accordingly for your system if you want to image a different device or partition.

Create Whole Disk Image of Windows and Lenovo Recovery

I did this using SSHFS and the program dd

sudo dd if=/dev/sda | pv | gzip -c > /my/sshfs/path

I ended up with 2400% compression!

Now go back and download the distro you want to install, I used a unofficial installer with extra firmware to support my usb wireless adapter. Again no changes to default bios is required for New releases of CentOS, Debian, and Ubuntu. For Debian you should use Jessie, I'm not sure if wheezy or wheezy-backports has efi support or not.