Writing raw image to partition

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:[color=blue]

Searching for boot device…
[/color]

I receive:[color=blue]

Failed to find boot device!
[/color]

Does anyone have any ideas?


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048

mruz wrote:[color=blue]

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:[color=green]

Searching for boot device…
[/color]

I receive:[color=green]

Failed to find boot device!
[/color]

Does anyone have any ideas?

[/color]
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:[color=blue]

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:[color=green]

Searching for boot device…
[/color]

I receive:[color=green]

Failed to find boot device!
[/color]

Does anyone have any ideas?

[/color]
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

vazhavandan;2575069 Wrote:[color=blue]

Is that a live image ?
[/color]

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


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048

mruz;2575072 Wrote:[color=blue]

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

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’
(https://forums.opensuse.org/entry.php?b=122&bt=680)

Thank You,


My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

Software efficiency halves every 18 months, thus compensating for
Moore’s Law

:)Its James again from Austin, Texas

jdmcdaniel3’s Profile: http://forums.opensuse.org/member.php?userid=43440
View this thread: http://forums.opensuse.org/showthread.php?t=489048

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-.


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048

mruz;2575716 Wrote:[color=blue]

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-.[/color]

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,


My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

Software efficiency halves every 18 months, thus compensating for
Moore’s Law

:)Its James again from Austin, Texas

jdmcdaniel3’s Profile: http://forums.opensuse.org/member.php?userid=43440
View this thread: http://forums.opensuse.org/showthread.php?t=489048

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”.


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048

Can somebody check my “writing raw to partition” procedure on own pc?
You can download minisuse from ‘susestudio.com
(http://susestudio.com/a/3Xsp3A/minisuse) or ‘minisuse.org
(http://www.minisuse.org/iso/).


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048

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?


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048

mruz;2591550 Wrote:[color=blue]

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?[/color]

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’
(https://forums.opensuse.org/blogs/comments/comment680.html)

Thank You,


My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

Software efficiency halves every 18 months, thus compensating for
Moore’s Law

:)Its James again from Austin, Texas

jdmcdaniel3’s Profile: http://forums.opensuse.org/member.php?userid=43440
View this thread: http://forums.opensuse.org/showthread.php?t=489048

[QUOTE=mruz;14810]…

Does anyone have any ideas?[/QUOTE]

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

@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.


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048

mruz;2592038 Wrote:[color=blue]

@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.[/color]

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,


My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

Software efficiency halves every 18 months, thus compensating for
Moore’s Law

:)Its James again from Austin, Texas

jdmcdaniel3’s Profile: http://forums.opensuse.org/member.php?userid=43440
View this thread: http://forums.opensuse.org/showthread.php?t=489048

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:

Code:

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


mruz

mruz’s Profile: http://forums.opensuse.org/member.php?userid=72166
View this thread: http://forums.opensuse.org/showthread.php?t=489048