Writing raw image to partition

Hi,

I’m trying to write USB & disk image of miniSUSE to sda9 partition, add grub entry and boot sysetm, but I have a problem.

I do it like this:


#Format partition eg. sda9
mkfs.ext3 -m 0 /dev/sda9
rm -r lost+found/

#Create directiories
mkdir /mnt/loop
mkdir /mnt/miniSUSE

#Mount your raw disk image as a loopback device
losetup /dev/loop0 /home/mruz/miniSUSE/miniSUSE.x86_64-0.4.35.raw

#Add your partitions to /dev/mapper/loop0pX
kpartx -va /dev/loop0

#Mount partition as read-only and sda9
mount -o ro /dev/mapper/loop0p1 /mnt/loop/
mount /dev/sda9 /mnt/miniSUSE

#Copy files from image to mounted partition
cp -R /mnt/loop/* /mnt/miniSUSE/


#Clean up
umount /mnt/loop/

#Remove the mapper devices:
kpartx -d /dev/loop0

#Remove the loopback device:
losetup -d /dev/loop0

#Add entry to grub /etc/grub.d/40_custom
menuentry 'miniSUSE' {
set root=(hd0,9)
linux /boot/linux.vmx quiet splash=silent
initrd /boot/initrd.vmx
}

#Rebuild grub2 config
grub2-mkconfig -o /boot/grub2/grub.cfg

In the first boot stage miniSUSE is loading, but when:

Searching for boot device…

I receive:

Failed to find boot device!

Does anyone have any ideas?

mruz wrote:
>
> Hi,
>
> I’m trying to write USB & disk image of ‘miniSUSE’
> (http://susestudio.com/a/3Xsp3A/minisuse) to sda9 partition, add grub
> entry and boot sysetm, but I have a problem.
>
> I do it like this:
>
> Code:
> --------------------
>
> #Format partition eg. sda9
> mkfs.ext3 -m 0 /dev/sda9
> rm -r lost+found/
>
> #Create directiories
> mkdir /mnt/loop
> mkdir /mnt/miniSUSE
>
> #Mount your raw disk image as a loopback device
> losetup /dev/loop0 /home/mruz/miniSUSE/miniSUSE.x86_64-0.4.35.raw
>
> #Add your partitions to /dev/mapper/loop0pX
> kpartx -va /dev/loop0
>
> #Mount partition as read-only and sda9
> mount -o ro /dev/mapper/loop0p1 /mnt/loop/
> mount /dev/sda9 /mnt/miniSUSE
>
> #Copy files from image to mounted partition
> cp -R /mnt/loop/* /mnt/miniSUSE/
>
>
> #Clean up
> umount /mnt/loop/
>
> #Remove the mapper devices:
> kpartx -d /dev/loop0
>
> #Remove the loopback device:
> losetup -d /dev/loop0
>
> #Add entry to grub /etc/grub.d/40_custom
> menuentry ‘miniSUSE’ {
> set root=(hd0,9)
> linux /boot/linux.vmx quiet splash=silent
> initrd /boot/initrd.vmx
> }
>
> #Rebuild grub2 config
> grub2-mkconfig -o /boot/grub2/grub.cfg
>
> --------------------
>
>
> In the first boot stage miniSUSE is loading, but when:
>>
>> Searching for boot device…
>>
>
> I receive:
>>
>> Failed to find boot device!
>>
>
> Does anyone have any ideas?
>
>
Is that a live image ?


GNOME 3.6.2
openSUSE Release 12.3 (Dartmouth) 64-bit
Kernel Linux 3.7.10-1.16-desktop

mruz wrote:
>
> Hi,
>
> I’m trying to write USB & disk image of ‘miniSUSE’
> (http://susestudio.com/a/3Xsp3A/minisuse) to sda9 partition, add grub
> entry and boot sysetm, but I have a problem.
>
> I do it like this:
>
> Code:
> --------------------
>
> #Format partition eg. sda9
> mkfs.ext3 -m 0 /dev/sda9
> rm -r lost+found/
>
> #Create directiories
> mkdir /mnt/loop
> mkdir /mnt/miniSUSE
>
> #Mount your raw disk image as a loopback device
> losetup /dev/loop0 /home/mruz/miniSUSE/miniSUSE.x86_64-0.4.35.raw
>
> #Add your partitions to /dev/mapper/loop0pX
> kpartx -va /dev/loop0
>
> #Mount partition as read-only and sda9
> mount -o ro /dev/mapper/loop0p1 /mnt/loop/
> mount /dev/sda9 /mnt/miniSUSE
>
> #Copy files from image to mounted partition
> cp -R /mnt/loop/* /mnt/miniSUSE/
>
>
> #Clean up
> umount /mnt/loop/
>
> #Remove the mapper devices:
> kpartx -d /dev/loop0
>
> #Remove the loopback device:
> losetup -d /dev/loop0
>
> #Add entry to grub /etc/grub.d/40_custom
> menuentry ‘miniSUSE’ {
> set root=(hd0,9)
> linux /boot/linux.vmx quiet splash=silent
> initrd /boot/initrd.vmx
> }
>
> #Rebuild grub2 config
> grub2-mkconfig -o /boot/grub2/grub.cfg
>
> --------------------
>
>
> In the first boot stage miniSUSE is loading, but when:
>>
>> Searching for boot device…
>>
>
> I receive:
>>
>> Failed to find boot device!
>>
>
> Does anyone have any ideas?
>
>
FAQ
https://forums.opensuse.org/english/get-technical-help-here/how-faq-forums/unreviewed-how-faq/484223-how-boot-opensuse-dvd-hard-disk-grub2.html

GNOME 3.6.2
openSUSE Release 12.3 (Dartmouth) 64-bit
Kernel Linux 3.7.10-1.16-desktop

No, it’s whole disk image (.raw), but I’m trying to write it to a specific partition (sda9) and boot.

Normally, you can not boot from sda9 unless Grub has been loaded into the MBR or Partitions 1, 2, 3 or 4 and you are not really “booting” from sda9. Futher, RAW writes must be made to an “identical” partition size and type for a raw write to work. But most likley when switching disks, grub is not install right to work with sda9.

For more info on Partitions have a look here: Creating Partitions During Install for MBR and GPT Hard Disks - Blogs - openSUSE Forums

Thank You,

I have installed openSUSE. Grub is on extended partition and it can boot eg. Mint from sda6, so there is no problem.
miniSUSE start loading, but it stops at the Searching for boot device.

Yes, but the only the only way to boot anything from sdx5 or higher, is grub must be in the MBR or in partitions 1, 2, 3 or 4. Placing grub into an Extended Partition is dangerous and most often will fail in a dual boot setup. And never run the Windows Partition program when grub is loaded into an active marked Extended Partition which corrupt its setup.

Since it is not working as you can see, a more simple setup is suggested.

Thank You,

I moved GRUB to MBR but no avail.
As I said, I think it is not grub problem, because system starts booting, minisuse’s kernel is loading and stops at the stage “Searching for boot device”.

Can somebody check my “writing raw to partition” procedure on own pc?
You can download minisuse from susestudio.com or minisuse.org.

Maybe kernel linux.vmx always looking for boot at the first partition eg sda1 and I can not change it by parameter in the linux line?

For MBR hard disk partitions, the PC always reads in and executes the Master Boot Sector. With Grub and Grub 2, you can load Grub into the MBR and allow the booting from any openSUSE root disk (1-5 or higher) partition. Else, if the MBR is loaded with normal boot code, you can only boot from partitions numbered 1, 2, 3 and 4. For more info look into my blog on partition types: Creating Partitions During Install for MBR and GPT Hard Disks - Blogs - openSUSE Forums

Thank You,

mruz;14810 Wrote:
> …
>
> Does anyone have any ideas?

Could it be your initrd image is simply missing the needed drivers for
the disk controller?

I’m also curious, why sda9? This is not a dedicated system you are
writing the image on? I normally just “dd” raw images over a disk
device. It you have other partitions/data on the disk you are writing to
& need to keep… I get why you are doing it, but it does seem somewhat
too complicated. :slight_smile:

Cheers,
Willem


Knowledge Partner (voluntary sysop)

If you find a post helpful and are logged into the web interface,
please show your appreciation and click on the star below it. Thanks!

Magic31’s Profile: http://forums.suse.com/member.php?userid=73
View this thread: http://forums.suse.com/showthread.php?t=3057

@jdmcdaniel3 why mint located at sda6 is booting normaly?

@Magic31 I have few partitions and few operating systems on this disk, so I prepared partition for testing susestudio’s systems (sda9). I don’t want erase all data on this disk during written some system like minisuse, but I would like run it natively from HDD.

For MBR formatted hard disks, if you install grub into the MBR, any partition number can be “booted”, but its a grub trick.

Thank You,

I have reinstalled openSUSE and moved Grub to MBR. Now I have separated sda1 for testing the susestudio’s systems.
But no avail, still the same error: Failed to find boot device! Before the error I’m getting also the message:

udevd[294]: failed to execute '/usr/bin/sg_inq' '/usr/bin/sq_ing -p di --export /dev/sda': No such file or directory