PDA

View Full Version : Writing raw image to partition



mruz
28-Jul-2013, 12:26
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?


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

vazhavandan
28-Jul-2013, 12:31
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

vazhavandan
28-Jul-2013, 12:33
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

mruz
28-Jul-2013, 12:46
vazhavandan;2575069 Wrote:
>
> Is that a live image ?
>

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

jdmcdaniel3
28-Jul-2013, 16:26
mruz;2575072 Wrote:
> 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'
(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

mruz
30-Jul-2013, 20:56
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

jdmcdaniel3
30-Jul-2013, 23:36
mruz;2575716 Wrote:
> 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,


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

mruz
08-Sep-2013, 06:26
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

mruz
15-Sep-2013, 11:16
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

mruz
16-Oct-2013, 12:26
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

jdmcdaniel3
16-Oct-2013, 14:06
mruz;2591550 Wrote:
> 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'
(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

Magic31
17-Oct-2013, 22:11
...

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

Cheers,
Willem

mruz
18-Oct-2013, 13:46
@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

jdmcdaniel3
18-Oct-2013, 13:56
mruz;2592038 Wrote:
> @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,


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

mruz
26-Oct-2013, 20:06
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