title: Rescue partition in Yocto image
body: <p>I need to create an image using Yocto that includes a rescue partition. That is, another root partition which is selectable in grub menu.</p>
  
  <p>I am currently creating an image which I dd to our target Intel board's internal SSD chip after booting from USB. This is working, but I now need to duplicate the current root partition as a "rescue" partition for in case something ever goes wrong with the root partition.</p>
  
  <p>So currently I have a working wks (kickstart) file with 5 partitions defined as:</p>
  
  <pre><code>part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label boot --active --align 1024
  part / --source rootfs --ondisk sda --fstype=ext4 --label root --align 1024 --use-uuid --extra-space 1024
  part /rescue --source rootfs --ondisk sda --fstype=ext4 --label rescue --align 1024 --use-uuid --extra-space 1024
  part swap --ondisk sda --size 1024 --label swap --fstype=swap
  part /home --ondisk sda --fstype=ext4 --label home --align 1024 --use-uuid --size=1024
  bootloader --configfile="grub.cfg"
  </code></pre>
  
  <p>The grub configuration has two menu options and I am able to boot from the default first menu option.</p>
  
  <pre><code>menuentry 'boot'{
   linux /bzImage root=/dev/sda2 3 console=ttyS2,115200n8 rootfstype=ext4
  }
  menuentry 'rescue'{
   linux /bzImage root=/dev/sda3 3 console=ttyS2,115200n8 rootfstype=ext4
  }
  </code></pre>
  
  <p>The grub configuration selects the second or the third partition as root. This works with the fixed order of partitions in the wks file.</p>
  
  <p>My problem is that if I select the 'rescue' partition in grub, the system starts to boot but the Linux kernel fails to find a root partition. Here is the last kernel messages before the kernel panic:</p>
  
  <pre><code>:&lt;snip&gt;
  :
  ata1.00: ATA-8: 32GB NANDrive, D A431F4, max UDMA/133
  ata1.00: 62533296 sectors, multi 0: LBA48 
  ata1.00: configured for UDMA/133
  scsi 0:0:0:0: Direct-Access     ATA      32GB NANDrive    31F4 PQ: 0 ANSI: 5
  sd 0:0:0:0: [sda] 62533296 512-byte logical blocks: (32.0 GB/29.8 GiB)
  sd 0:0:0:0: [sda] Write Protect is off
  sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
  sd 0:0:0:0: Attached scsi generic sg0 type 0
   sda: sda1 sda2 sda3 sda4 &lt; sda5 sda6 &gt;
  :
  :&lt;snip&gt;
  :
  List of all partitions:
  0100           16384 ram0 
   (driver?)
  0101           16384 ram1 
   (driver?)
  0102           16384 ram2 
   (driver?)
  0103           16384 ram3 
   (driver?)
  0800        31266648 sda 
   driver: sd
    0801           24571 sda1 9f293dfb-01
  
    0802         4151722 sda2 9f293dfb-02
  
    0803         4151722 sda3 9f293dfb-03
  
    0804               1 sda4 
  
    0805         1048576 sda5 9f293dfb-05
  
    0806         1048576 sda6 9f293dfb-06
  
  No filesystem could mount root, tried: 
   ext4
  
  Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,3)
  :
  :
  </code></pre>
  
  <p>I suspect Yocto does something when building the image which I just need to control but am unable to find the source of this problem.
  Any help is appreciated</p>