Sharvin
Posts: 17
Joined: Tue Feb 19, 2019 1:19 pm

Flashing Debian Image on SD card Partition

Thu Feb 21, 2019 8:28 am

I have an sd card with 2 Partitions. mmcblk0 is the disk and mmcblk0p1, mmcblk0p2 are the 2 partitions I have created.

I am trying to flash the Debian OS on the Partition using the dd command.

Code: Select all

dd if=os.img bs=10M of=/dev/mmcblk0p1
I am getting the following output

Code: Select all

3565158400 bytes (3.6 GB, 3.3 GiB) copied, 297 s, 12.0 MB/s
106+1 records in
106+1 records out
3565158400 bytes (3.6 GB, 3.3 GiB) copied, 296.587 s, 12.0 MB/s
Now when I try to mount the partition using mount -t auto /dev/mmcblk0p1 mydir

I am getting the following error:

Code: Select all

mount: wrong fs type, bad option, bad superblock on /dev/mmcblk0p1,
 missing codepage or helper program, or other error
 In some cases useful info is found in syslog - try
 dmesg | tail or so.
My dmesg | tail Output:

Code: Select all

[  856.292964] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[  856.292983] F2FS-fs (mmcblk0p1): Can't find valid F2FS filesystem in 1th superblock
[  856.305466] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[  856.305483] F2FS-fs (mmcblk0p1): Can't find valid F2FS filesystem in 2th superblock
[  856.315244] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[  856.315256] F2FS-fs (mmcblk0p1): Can't find valid F2FS filesystem in 1th superblock
[  856.324437] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)Units: sectors of 1 * 512 = 512 bytes
Even I am not able to boot from the partition.

But if I try the dd command on mmcblk0 disk it is working perfectly. I am able to mount and boot.

According to my understanding, Linux OS is designed to be installed on a disk, not on a partition and dd is to be used for the flashing on the disk.

I want to write a Debian image on a Partition mmcblk0p1 using a command line tool. How can I achieve this?

I tried dd, pv, cat, cp, ddsd, Dcfldd But ended up with the same result.

User avatar
B.Goode
Posts: 8045
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Flashing Debian Image on SD card Partition

Thu Feb 21, 2019 8:40 am

What precisely is this "Debian" of which you speak?

Which download are you trying to use?

The image of the Raspbian distribution from the Raspberry Pi Foundation is a complete bit-by-bit copy of a bootable medium which itself embodies all the partition information needed to regenerate a further bootable micro SD card or usb memory stick. Maybe you could learn from the way that has been structured and implemented.

fruitoftheloom
Posts: 20143
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Flashing Debian Image on SD card Partition

Thu Feb 21, 2019 8:41 am

Sharvin wrote:
Thu Feb 21, 2019 8:28 am
I have an sd card with 2 Partitions. mmcblk0 is the disk and mmcblk0p1, mmcblk0p2 are the 2 partitions I have created.

I am trying to flash the Debian OS on the Partition using the dd command.

Code: Select all

dd if=os.img bs=10M of=/dev/mmcblk0p1
I am getting the following output

Code: Select all

3565158400 bytes (3.6 GB, 3.3 GiB) copied, 297 s, 12.0 MB/s
106+1 records in
106+1 records out
3565158400 bytes (3.6 GB, 3.3 GiB) copied, 296.587 s, 12.0 MB/s
Now when I try to mount the partition using mount -t auto /dev/mmcblk0p1 mydir

I am getting the following error:

Code: Select all

mount: wrong fs type, bad option, bad superblock on /dev/mmcblk0p1,
 missing codepage or helper program, or other error
 In some cases useful info is found in syslog - try
 dmesg | tail or so.
My dmesg | tail Output:

Code: Select all

[  856.292964] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[  856.292983] F2FS-fs (mmcblk0p1): Can't find valid F2FS filesystem in 1th superblock
[  856.305466] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[  856.305483] F2FS-fs (mmcblk0p1): Can't find valid F2FS filesystem in 2th superblock
[  856.315244] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[  856.315256] F2FS-fs (mmcblk0p1): Can't find valid F2FS filesystem in 1th superblock
[  856.324437] F2FS-fs (mmcblk0p1): Magic Mismatch, valid(0xf2f52010) - read(0x0)Units: sectors of 1 * 512 = 512 bytes
Even I am not able to boot from the partition.

But if I try the dd command on mmcblk0 disk it is working perfectly. I am able to mount and boot.

According to my understanding, Linux OS is designed to be installed on a disk, not on a partition and dd is to be used for the flashing on the disk.

I want to write a Debian image on a Partition mmcblk0p1 using a command line tool. How can I achieve this?

I tried dd, pv, cat, cp, ddsd, Dcfldd But ended up with the same result.

There is no officially supported Debian ARMHF for the Raspberry Pi.


Raspbian Stretch download is an .IMG file which is zipped:

https://www.raspberrypi.org/downloads/raspbian/

.IMG are written to the SD Card and creates the required partitions.


The Raspberry Pi SBC on boot up can only natively read the first Partition which must be FAT 12/16/32 formatted:

https://wiki.beyondlogic.org/index.php? ... ot_Process
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

code_exec
Posts: 271
Joined: Sun Sep 30, 2018 12:25 pm

Re: Flashing Debian Image on SD card Partition

Thu Feb 21, 2019 9:01 am

Raspberry Pi OS images usually contain two partitions: a boot partition containing the kernel and bootloader, and a root partition containing the system itself. The images consist of an MBR partition table containing the boot and root partitions. By writing the image to a microSD card, you are essentially flashing the partition table from the image to the microSD card partition table. You cannot flash a partition table to a partition, so you'll have to flash the image file to /dev/mmcblk0 and not /dev/mmcblk0p1. Flashing the image will create the partitions /dev/mmcblk0p1 and /dev/mmcblk0p2 on the microSD card anyway.
Ubuntu 18.04 LTS desktop images for the Raspberry Pi 3.

https://github.com/CodeExecution/Ubuntu-ARM64-RPi

Sharvin
Posts: 17
Joined: Tue Feb 19, 2019 1:19 pm

Re: Flashing Debian Image on SD card Partition

Thu Feb 21, 2019 9:26 am

fruitoftheloom wrote:
Thu Feb 21, 2019 8:41 am
There is no officially supported Debian ARMHF for the Raspberry Pi.


Raspbian Stretch download is an .IMG file which is zipped:

https://www.raspberrypi.org/downloads/raspbian/

.IMG are written to the SD Card and creates the required partitions.


The Raspberry Pi SBC on boot up can only natively read the first Partition which must be FAT 12/16/32 formatted:

https://wiki.beyondlogic.org/index.php? ... ot_Process
code_exec wrote:
Thu Feb 21, 2019 9:01 am
Raspberry Pi OS images usually contain two partitions: a boot partition containing the kernel and bootloader, and a root partition containing the system itself. The images consist of an MBR partition table containing the boot and root partitions. By writing the image to a microSD card, you are essentially flashing the partition table from the image to the microSD card partition table. You cannot flash a partition table to a partition, so you'll have to flash the image file to /dev/mmcblk0 and not /dev/mmcblk0p1. Flashing the image will create the partitions /dev/mmcblk0p1 and /dev/mmcblk0p2 on the microSD card anyway.
Thank you for the Response I want to flash the Operating system on the partition. As I have a MicroSD card of 8Gb and I have 2 partitions mmcblk0p1 and mmcblk0p2. I want to flash 2 Os, one on the mmcblk0p1 and other on the mmcblk0p2. I tried doing this with dd but it failed, Is there any other command line tool available for this purpose. ( Like creating a multi-bootable SD card )

fruitoftheloom
Posts: 20143
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Flashing Debian Image on SD card Partition

Thu Feb 21, 2019 10:07 am

Sharvin wrote:
Thu Feb 21, 2019 9:26 am
fruitoftheloom wrote:
Thu Feb 21, 2019 8:41 am
There is no officially supported Debian ARMHF for the Raspberry Pi.


Raspbian Stretch download is an .IMG file which is zipped:

https://www.raspberrypi.org/downloads/raspbian/

.IMG are written to the SD Card and creates the required partitions.


The Raspberry Pi SBC on boot up can only natively read the first Partition which must be FAT 12/16/32 formatted:

https://wiki.beyondlogic.org/index.php? ... ot_Process
code_exec wrote:
Thu Feb 21, 2019 9:01 am
Raspberry Pi OS images usually contain two partitions: a boot partition containing the kernel and bootloader, and a root partition containing the system itself. The images consist of an MBR partition table containing the boot and root partitions. By writing the image to a microSD card, you are essentially flashing the partition table from the image to the microSD card partition table. You cannot flash a partition table to a partition, so you'll have to flash the image file to /dev/mmcblk0 and not /dev/mmcblk0p1. Flashing the image will create the partitions /dev/mmcblk0p1 and /dev/mmcblk0p2 on the microSD card anyway.
Thank you for the Response I want to flash the Operating system on the partition. As I have a MicroSD card of 8Gb and I have 2 partitions mmcblk0p1 and mmcblk0p2. I want to flash 2 Os, one on the mmcblk0p1 and other on the mmcblk0p2. I tried doing this with dd but it failed, Is there any other command line tool available for this purpose. ( Like creating a multi-bootable SD card )

If you want to multi-boot you are going about achieving your aim the wrong way.


BerryBoot is a multi-boot manager where all installed OSes share the same kernel / firmware:

https://www.berryterminal.com/doku.php/berryboot


NoobS & PiNN are installer / choosers where each install OS is separated:

https://www.raspberrypi.org/downloads/noobs/

https://www.raspberrypi.org/forums/view ... 3&t=142574


Each above solution have pros and cons so investigate and choose what suits your requirements......
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

Sharvin
Posts: 17
Joined: Tue Feb 19, 2019 1:19 pm

Re: Flashing Debian Image on SD card Partition

Thu Feb 21, 2019 10:36 am

fruitoftheloom wrote:
Thu Feb 21, 2019 10:07 am
Sharvin wrote:
Thu Feb 21, 2019 9:26 am
fruitoftheloom wrote:
Thu Feb 21, 2019 8:41 am
There is no officially supported Debian ARMHF for the Raspberry Pi.


Raspbian Stretch download is an .IMG file which is zipped:

https://www.raspberrypi.org/downloads/raspbian/

.IMG are written to the SD Card and creates the required partitions.


The Raspberry Pi SBC on boot up can only natively read the first Partition which must be FAT 12/16/32 formatted:

https://wiki.beyondlogic.org/index.php? ... ot_Process
code_exec wrote:
Thu Feb 21, 2019 9:01 am
Raspberry Pi OS images usually contain two partitions: a boot partition containing the kernel and bootloader, and a root partition containing the system itself. The images consist of an MBR partition table containing the boot and root partitions. By writing the image to a microSD card, you are essentially flashing the partition table from the image to the microSD card partition table. You cannot flash a partition table to a partition, so you'll have to flash the image file to /dev/mmcblk0 and not /dev/mmcblk0p1. Flashing the image will create the partitions /dev/mmcblk0p1 and /dev/mmcblk0p2 on the microSD card anyway.
Thank you for the Response I want to flash the Operating system on the partition. As I have a MicroSD card of 8Gb and I have 2 partitions mmcblk0p1 and mmcblk0p2. I want to flash 2 Os, one on the mmcblk0p1 and other on the mmcblk0p2. I tried doing this with dd but it failed, Is there any other command line tool available for this purpose. ( Like creating a multi-bootable SD card )

If you want to multi-boot you are going about achieving your aim the wrong way.


BerryBoot is a multi-boot manager where all installed OSes share the same kernel / firmware:

https://www.berryterminal.com/doku.php/berryboot


NoobS & PiNN are installer / choosers where each install OS is separated:

https://www.raspberrypi.org/downloads/noobs/

https://www.raspberrypi.org/forums/view ... 3&t=142574


Each above solution have pros and cons so investigate and choose what suits your requirements......
Okay, I'll try that Thank you for the Response

Return to “Debian”