See the great reference http://www.iceflatline.com/2009/09/how-to-dual-boot-Windows-7-and-linux-using-bcdedit/
Introduction
I have PGP-WDE on a Windows 7 laptop, but I want to have a Linux dual boot partition and also with whole disk encryption. This is how it was done.
Detailed situation
Usually,
- A virtual machine is convenient.
- Home directory encryption is enough.
- Just use PGP-WDE is possible.
- Performance oriented multi-platform development.
- New low level programming (e.g., CUDA 4.0)
- The company policy needs Whole Disk Encryption.
- And PGP-WDE has not yet supported on new kernel of Linux and MacOS. At 2012-1-25(Wed), No Ubuntu 11.x support and no MacOSX Lion support yet. http://www.symantec.com/products/sysreq.jsp?pcid=pcat_info_risk_comp&pvid=wd_encryption_1
Suggested solution
- Windows 7 partition is encrypted by PGP-WDE.
- Linux (Kubuntu 11.10) partition is encrypted by dm-crypt.
- (My machine is Lenovo W520 with 500GB HD.)
How to do it?
1. Decrypt PGP disk
Use PGP Disk tool to decrypt your disk. Because you can not install Linux on a decrypted disk. It took 8 hours for 500GB disk on Lenovo W520.
2. Partition the disk
- Use Windows Disk Management or any other tool to shrink the Windows 7 partition.
- Note: Windows 7 has a small extra partition (around 300MB size). This is necessary and do not delete it.
Push ThinkVantage button, and push F12 to boot other drive. I use Kbuntu 11.10 and boot via USB key.
Install Kubuntu
- The alternate CD contains whole disk encryption menu. Kubuntu Desktop only offers home directory encryption option. (You also need a Desktop CD later)
- We will have "/boot", "/", and swap partition. swap may not needed.
- Note: /boot should not be encripted.
- Choose Manual. I made following partitions
- primary 200MB ext4 /boot, /dev/sda4 (You should remember /boot partition's device name)
- logical 241GB K lvm
- logical 8G swap
- I choose the / partition for lvm
- Create encrypted volumes
- Choose /dev/sda6 (lvm), /dev/sda5 (swap)
- Encryption method: Device mapper (dm-crypt)
- Encryption: aes
- Finished encryption
- Input pass phrase
After install the base system, the installer asked us where the GRUB boot loader should be installed.
- Say 'No' to: Install the GRUB boot loader to the master boot record?
- Install the GRUB boot loader in the /boot linux partition (my case, /dev/sda4)
- Reboot the Linux (from USB key or Live CD, not Alternate CD)4.
Dual boot set up from Windows 7 partition
- After the reboot from Desktop CD/USB key, we will set up the dual boot.
- Copy the relevant info to a USB key (mounted on /media/myusbkey in this example) or similar:
sudo dd if=/dev/sda4 of=/media/myusbkey/linux.bin bs=512 count=1
- This makes only 512 byte file.
- Boot Windows 7.
- Copy linux.bin from the USB key to some place on the Windows partition, e.g. C:\linux.bin
- Run the command line tool as administrator (right click the icon for that).
- Run the following commands:
bcdedit /create /d "Linux" /application BOOTSECTOR
- "Linux" can of course be something else. The command outputs a long ID, use that instead of {ID} in the following commands.
bcdedit /set {ID} device partition=c:5. Linux boot set up
bcdedit /set {ID} path \linux.bin
bcdedit /displayorder {ID} /addlast
bcdedit /timeout 10
- I failed boot in normal mode, but I can boot recovery mode.
- It seems normal mode make the encryption passphrase input prompt invisible. It looks like a hung up. But this seems Linux is asking disk's pass phrase. Just we can not see the prompt.
- I changed the grub settings. Don't do quiet mode and graphical mode. I could not find /boot/grub/menu.lst file in Kubuntu 11.10. There is a /etc/default/grub file.
- boot with recovery mode (You will be asked the passphrase.)
- sudo vi /etc/default/grub
- Edit the line: GRUB_CMDLINE_LINUX_DEFAULT="splash nomodeset pci=noacpi" from "quiet splash"
- run sudo update-grub (I think this changes /boot/grub/grub.cfg)
- Note: If you don't have pci=noacpi here, Lenovo W520 with Linux kernel 3.0.0.15 hung up when using NVIDIA card. If you have still problem, try acpi=off. (Intel integrated graphics card has no problem.)
6. Windows 7 PGP partition encryption
- Use the PGP tool to re-encrypt the Windows partition (not the whole disk). 240GB encripytion took 6 and half hours in my case.
- When you want to encrypt Windows partition, you must choose: Encrypt Whole Disk, then, the PGP Desktop asked you to create new user. I choose Windows password and default settings.
Now your whole harddisk is encrypted except linux /boot partition. But, there is no secret here.
Thanks to Daniel, Joachim, and Joerg for many hints.
Comments