Install Debian on external drive (postable install with bootloader included)
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Install Debian on external drive (postable install with bootloader included)
Hello,
I have a 2TB external USB on which I would like to install Debian on one of the partition. This is what I have done:
1) With Gpart I have resized and created a 200GB free partition
2) I booted on Debian live usb, and chosen the install
3) II chosen the "Manual partitioning" option and selected my free partition on my external HDD
- it created for me the root / (ext4) and a swap partition on that 200GB free partition I had
4) Then the install went through with success. I was a bit puzzled because it did not ask me where to install the boot loader ??
After I restarted my Macbook (on which I had installed rEFind) and can see it added the "Debian" entry and I can boot on my Debian perfectly.
Now, however, If I plug this external HDD on an other Macbook I have (Still with rEFind on it), I cannot see the Debian entry en the boot menu
So my question is, Did I forget to do something ? Is it possible to have a fully portable Debian install on my external HDD so that I can plug it in any computer and boot on it ?
If you put this external drive on another system, you will have to add a boot entry that reflects the organization and naming convention on that system. Note that it MAY be different than the other system, so first find out what the other system uses as the name I the disk and the partition order, then edit the boot entry to reflect this information.
It may be similar or completely different depending on how each system recognizes and names its devices and partitions.
I've never used a Mac so I'm not sure how this would work. With a standard PC, you would have a separate EFI partition. Do you have an EFI partition on the Mac? On a PC, the EFI partition would likely be on the primary drive and the EFI files for Debian would be placed there rather than on the external drive. If Macs are similar, you would also need an EFI partition on the secondary drive on which you installed Debian. You could use the Debian install usb to check the external drive for an EFI partition or the Mac drive. Hopefully, someone familiar with Macs will see your post.
I've never used the Debian LiveCD, so I don't know for sure how it does an install - I have, however, used the standard Debian installer netinst CD many times. Most of my experience is with old fashioned PC clone type hardware with traditional MBR installs. I have one Mac, though, and I have done some UEFI type installs.
My experience with my Mac Mini is that I did NOT want to modify the internal drive's bootloader at all. Since I had no experience with EFI installs, I didn't want to mess things up. Especially since I had no idea how I might rescue the Mac's OSX bootloader if I screwed things up.
So, I decided to boot Debian using an external USB drive instead. At the time I did my first install, this was before Debian had really good EFI support, so it asked me what sort of bootloader I wanted to do. I specified grub on the USB drive, which worked...sort of.
Okay, here's an annoying thing about Macs. Apple does not let us specify a boot order, so there is no way to make the system boot a USB bootloader by default! You MUST press "alt" when the screen is grey, and hold it just right so that it will bring up a boot menu - at which point I can manually select the "Windows" USB drive to boot from. This is very annoying, but I live with it.
The fact that you don't mention anything like this means that you're booting from the internal drive's EFI bootloader.
Here's where my experience with UEFI type installs comes in handy. I have noticed that on the latest Debian installers, it does NOT ask you where you want to install the bootloader, if it detects UEFI. It'll just install a Debian menu choice on the internal drive's EFI bootloader. This is okay, if you never want to boot up your USB drive on any other computer. But if you do want to boot up your USB drive from another computer? Whoops, you're out of luck!
Okay, so that's annoying. But you can fix things! You want to install GRUB on your USB drive, so it has its own bootloader and can boot up on any computer (not just Macs - it'll work on other computers also). The basic steps are:
Code:
1) Boot up to your Debian install
2) Open up a terminal, and log in as root with "su" (or "sudo su" if you have an Ubuntu style install - that's an option for recent versions of Debian, for better or worse).
3) Install the grub package with:
apt-get install grub-pc
4) Update the grub menu with:
update-grub
5) Install the bootloader onto the MBR of your USB drive with:
grub-install /dev/sdb
Note that I'm assuming your USB drive is /dev/sdb. Make sure this is correct! You can confirm this with the following command:
Code:
fdisk -l
This will list all of the connected drives. Study the output of "fdisk -l" very carefully to ensure you are installing the GRUB bootloader onto the correct device.
At this point, your Debian install will be able to boot up on other computers.
However, since your other computer is a Mac, life is still not so simple. You'll need to press and hold the "Alt" or Apple key to bring up a boot menu when you boot up. Then, you'll see the USB drive as a "Windows" drive to boot from.
Okay, here's an annoying thing about Macs. Apple does not let us specify a boot order, so there is no way to make the system boot a USB bootloader by default! You MUST press "alt" when the screen is grey, and hold it just right so that it will bring up a boot menu - at which point I can manually select the "Windows" USB drive to boot from. This is very annoying, but I live with it.
It is infuriating, unintuitive, and unnecessary. Once rEFInd is installed, a boot menu is automatically produced that by default preselects the last booted OS.
It is infuriating, unintuitive, and unnecessary. Once rEFInd is installed, a boot menu is automatically produced that by default preselects the last booted OS.
I may just do that, since I've been using my Mac Mini exclusively for linux for years now.
My only concern is the ease with which I can return the Mac Mini to a pure stock state. Right now, it's extremely simple - I just remove the USB thumbdrive (which has a GRUB boot entry to RAMBOOT off of an nfs share...custom initrd and stuff).
If I install rEFInd, then I'd need some way to return the internal hard drive's bootloader to its original stock state. The following discussion thread seems to describe a way to do this, although it seems to apply to if you installed a (GRUB) MBR rather than restoring EFI after installing rEFInd.
I'm just wary because of my lack of familiarity, and because I burned myself with doing stuff without being 100% familiar with how OSX does things differently. I originally did a dual boot install by shrinking the OSX partition and making an ext3 partition for Debian in the space created. I did not know there wouldn't be a way to grow the OSX partition later, after I decided the slow 2.5" hard drive was bogging down the system (MUCH faster to run off an nfs shared SSD, and even faster to run off an internal tmpfs ramdisk). I eventually sorted things out, but it was a painful experience.
So, if I knew 100% how to definitely return the MacOS bootloader to its original state, I'd be a lot more comfortable with changing it.
Thanks for the tip! Wow, what a rabbit hole. It looks like the installation process would be the more complex part; if I figure out the installation process, then reversing the steps shouldn't be as hard.
Reading around, it looks like my strategy would be to copy my customized initrd and vmlinuz onto the vfat EFI partition itself (on this Mac Mini, this is simply /dev/sda1 on the internal 2.5" hard drive). Then, I can fashion a custom menu entry something like this:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.