I have an old laptop that has a built-in SD card reader, only it's not available at boot.

I can however grub boot linux (Debian) from a small 8GB USB key (USB 2.0), but it's very slow. The SD card is a lot faster and must be on a different interface.

I can't access the SD card from grub, but was wondering if I could load the Debian kernel and/or vmlinuz from the USB key and then continue booting from the SD card once the drivers for the SD card have been loaded in the kernel or initramfs?

I'm hesitant to mess with the grub config file since it clearly says do not edit, but it seems like you can specify different disks for the kernel/vmlinuz and initramfs; I'm just not sure how to do it and if loading either of those off the USB key will bring the SD card up?

Here's the relevant code from /boot/grub.cfg on the USB stick:

For booting into the USB stick:

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
    set gfxpayload="${1}"
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-aaaa-aaaa-a’ {
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_msdos
    insmod ext2
    set root='hd2,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1  aaaa-aaaa-a
      search --no-floppy --fs-uuid --set=root aaaa-aaaa-a
    echo    'Loading Linux 4.19.0-6-amd64 ...'
    linux   /boot/vmlinuz-4.19.0-6-amd64 root=UUID=aaaa-aaaa-a ro  quiet
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-4.19.0-6-amd64

For booting into the SD/MMC card:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Debian GNU/Linux 10 (buster) (on /dev/mmcblk0p1)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-XXXX-XXXX-X’ {
    insmod part_msdos
    insmod ext2
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root  XXXX-XXXX-X
      search --no-floppy --fs-uuid --set=root XXXX-XXXX-X
    linux /vmlinuz root=/dev/mmcblk0p1
    initrd /initrd.img

Thinking there must be a way to combine them?

I got it to boot off the SD card.

I had set up the SD card with LVM partitioning so had to install lvm2 onto the USB key since it was only setup as basic MBR partitioning.

I added:

insmod lvm
insmod ext2


### BEGIN /etc/grub.d/05_debian_theme ###



to the appropriate menuentry.

However, since the initramfs files are different on the USB and SD not everything loads properly at boot on the SD.

The USB install is a very minimal shell only boot whereas the SD is a full install with a desktop manager etc.

What I would like to do is have both separate and still be able to boot both with their respective initramfs files. I can do this for the USB card, and have a separate entry for the SD card to boot but it's using the minimal USB initramfs file.

The SD card considers /dev/mmcblk0p1 as its boot partition.

This results in two more questions:

  1. How can I tell grub config where the boot folder is for the SD card? Is it possible to specify it in grub.cfg? I've copied all the files from the /dev/mmcblk0p1 partition to /boot/bootsd on the USB key.

  2. How can I set the USB folder /boot/bootsd as /boot for the SD card? Use fstab and a symbolic link?


I think I have it figured out -- I simply changed:

initrd /initrd.img


initrd /bootsd/initrd.img

Then I created an fstab entry on the SD card for the USB sdc1 using the UUID. Then created an ln alias from the /media/usbboot/boot/bootsd to /boot on the SD system.

I haven't configured non-free wifi yet so haven't done an apt-get update but assuming it will work.

2 Answers 2


GRUB uses the system firmware routines (i.e. BIOS in your case) for all of its disk I/O operations, so if BIOS cannot read the SD card, GRUB won't be able to do it either.

GRUB's job is to load the Linux kernel and initramfs files to RAM, and then transfer control to the Linux kernel. At that point, GRUB's job is done and it won't be involved in any further actions. Everything after that point is done by the Linux kernel and whatever drivers and tools are included in the initramfs file.

So, if your initramfs on the USB stick includes the driver for the SD card, all you need to do is to edit the root= boot parameter on this line:

linux   /boot/vmlinuz-4.19.0-6-amd64 root=UUID=aaaa-aaaa-a ro  quiet

to this:

linux   /boot/vmlinuz-4.19.0-6-amd64 root=/dev/mmcblk0p1 ro  quiet

But this is only the first step.

In order to allow your system to also update your kernel and/or bootloader when needed, you should then arrange for the /boot directory of the USB stick to get automatically mounted as /boot on your mostly-SD-card-based system. Since there is already a /boot directory on the USB stick, you may have to configure /etc/fstab to mount the USB stick to some other location, and make /boot a symbolic link pointing to /wherever_the_USB_is_mounted/boot.

Then run grub-mkconfig -o /tmp/test-grub.cfg to autogenerate a dummy test grub.cfg file in /tmp/, compare it to the active one on the USB stick and verify that the result makes sense in terms of the USB stick. To test, you can move the grub.cfg file on the USB stick aside and replace it with the generated one. If it works, your system should now be capable of kernel updates while using your "boot from USB, root filesystem on SD" scheme. This should be the maximally conservative (minimum-risk) way to make the necessary changes.

Alternatively, once you get the system booted using the SD as the root filesystem, you could just copy the kernel and initramfs files from the current /boot directory to the root directory of the USB stick, mount it as /boot, then reinstall GRUB on the USB stick using grub-install. It should auto-generate the various paths in the new grub.cfg file (now in the root directory of the USB stick's filesystem) to match the new situation. You may also want to use update-initramfs -u to update your initramfs file, to ensure it matches the new configuration. After testing, you can then delete /boot/boot and other remaining sub-directories of the USB-based installation. This method results a bit cleaner configuration than the maximally conservative way, but runs the risk of boot failure if the reinstallation of GRUB to the USB is unsuccessful.

Regarding your EDIT 2:

  1. How can I tell grub config where the boot folder is for the SD card? Is it possible to specify it in grub.cfg? I've copied all the files from the /dev/mmcblk0p1 partition to /boot/bootsd on the USB key.

The grub-mkconfig simply expects to find the directory that contains the kernel and initramfs files at /boot. Your job is to arrange things to make the correct filesystem/directory be there. If you do this, any kernel and initramfs updates should get handled correctly automatically.

An alternative solution would be to write your own boot entry in /etc/grub.d/40_custom. Then you could use any pathnames you want - but you would also have to deal with updating them yourself, since a standard kernel package will simply install the vmlinuz-<version> file to /boot, create a companion initramfs file for it in the same directory, and run grub-mkconfig to refresh the configuration file in a standard location.

  1. How can I set the USB folder /boot/bootsd as /boot for the SD card? Use fstab and a symbolic link?

Exactly. Having the extra bootsd folder there complicates things somewhat, but it should be doable. A fstab entry might be something like this:

UUID=aaaa-aaaa-a /usbkey <filesystem type> defaults 0 2

This would place the non-symlink path to the folder at /usbkey/boot/bootsd.

Then you can move the current /boot directory on the SD's filesystem aside and replace it with a symbolic link:

mv /boot /boot.old
ln -s /usbkey/boot/bootsd /boot

Remember that when GRUB talks about root filesystem for GRUB's own purposes (set root=<something> or search ... --set=root ...), it only means the root directory of whatever filesystem GRUB is about to load files from. At boot time, GRUB does not see a single unified directory tree of Linux: it basically only looks at one filesystem at a time.

For GRUB, the root= option on the linux <somewhere>/vmlinuz-<version> root=... line is just one more boot option for the Linux kernel - but for the kernel and/or the start-up scripts in the initramfs file, this option specifies which filesystem is used as the root filesystem by Linux.

  • Thanks for a very detailed and comprehensive answer, appreciated! I will try your easy safe method first as I have already installed Debian 10 on both USB and SD. Don’t want to reinstall if I don’t have to as there were a lot of manual settings needed to get the USB setup. I’ll report back.
    – D.A. Reyn
    Nov 21, 2019 at 11:09
  • Ok so changing root= in the linux line didn’t work. Got a bunch of errors saying no such file or directory, then ended up in BusyBox with a prompt saying (initramfs). However the SD card access light did flicker.
    – D.A. Reyn
    Nov 21, 2019 at 11:58
  • EDIT: The grub config on the SD card is a bit different... will have to tinker some more.
    – D.A. Reyn
    Nov 21, 2019 at 12:33
  • I got it to boot the SD card, however I need more help, please see EDIT 2 in my original question.
    – D.A. Reyn
    Nov 23, 2019 at 6:25
  • Added my update before reading your update... anyway they are about the same... thanks again!
    – D.A. Reyn
    Nov 23, 2019 at 13:48

My case

Last week I installed Xubuntu in a computer with a new and fast nvme card, that is not recognized at boot in that computer.

Xubuntu uses the installer Ubiquity, and during the installation, at the partitioning window, I selected 'Something else' which means manual partitioning.

  • I put the root partition, /, onto the nvme card
  • I put the boot partition, /boot, onto an SSD, which is recognized at boot.

Your case

I think you can do something very similar with the current Debian installer. I have done manual partitioning with separate boot and home partitions with the old text mode Debian installer, and if the new installer cannot do it, you can probably fall back to the old text mode installer.

  • Put the root partition, /, onto the memory card (seen as mmcblk0 and its first partition mmcblk0p1 if connected via PCI).
  • Put the boot partition, /boot, onto the USB key.

Then continue and let the installer do the job.

  • Cool, I thought there might be something like that but didn’t see it in the graphical installer. Will try the text one. Thanks for your help!
    – D.A. Reyn
    Nov 21, 2019 at 11:06
  • 1
    @D.A.Reyn, Good luck and let us know the result :-)
    – sudodus
    Nov 21, 2019 at 11:13
  • So my original question was edited for grammar, and all thanks removed saying it’s implied. So just wanted to re-iterate my thanks to you both for your help!
    – D.A. Reyn
    Dec 7, 2019 at 3:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .