You are not logged in.

#1 2015-07-14 21:34:15

gsgleason
Member
Registered: 2012-10-08
Posts: 72

Why can I just write the arch iso to a usb drive and it works?

Other distributions require quite a bit if prep in order to create a bootable USB from the iso image.

How is it that the arch iso can be directly written to the USB drive with dd?

Offline

#2 2015-07-14 21:49:16

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: Why can I just write the arch iso to a usb drive and it works?

Would "it was designed to behave that way" be a sufficient answer?

Offline

#3 2015-07-14 21:54:53

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: Why can I just write the arch iso to a usb drive and it works?

Other distros can do that too. That prep work is optional, allowing you to continue to use the stick for storing other data, while the dd method creates a read-only device that's the size of the iso image instead of the stick's actual size. Another difference is that the other methods preserve the data that was already on the stick, while dd erases it. If you don't believe me, try it. I know at least Ubuntu and Fedora work by simply dd'ing their image.

Arch does this by using isohybrid from syslinux. Other distros might use that or some other method that does something similar.

Fun fact, on UEFI machines you don't even need dd. You can loop mount the image and simply copy its content to the stick. That's because UEFI will search for EFI/Boot/bootx86.efi on the stick and run that, no need to mess with boot sectors and other stuff that's required for BIOS booting.

Last edited by Gusar (2015-07-14 21:56:18)

Offline

#4 2015-07-15 07:15:47

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: Why can I just write the arch iso to a usb drive and it works?

Gusar wrote:

Fun fact, on UEFI machines you don't even need dd. You can loop mount the image and simply copy its content to the stick.

Fun fact number 2 -- `cp` works with all isohybrid images whether UEFI or not and you don't even need to mount the image:

# cp example.iso /dev/sdX
# sync

smile


Jin, Jîyan, Azadî

Offline

#5 2015-07-15 08:18:24

severach
Member
Registered: 2015-05-23
Posts: 198

Re: Why can I just write the arch iso to a usb drive and it works?

I  use NetBSD rawrite if I don't care what else is on the flash drive. I use Yumi if I want a FAT32 flash drive that I can use for other things.

Offline

#6 2015-07-15 09:00:48

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: Why can I just write the arch iso to a usb drive and it works?

Head_on_a_Stick wrote:

Fun fact number 2 -- `cp` works with all isohybrid images whether UEFI or not and you don't even need to mount the image:

# cp example.iso /dev/sdX
# sync

smile

Won't this erase the current content on the stick, like with dd? Copying the loop-mounted files, the data on the stick remains intact.

Offline

#7 2015-07-15 09:38:21

jagan605
Member
Registered: 2011-12-04
Posts: 26

Re: Why can I just write the arch iso to a usb drive and it works?

I do it as instructed in the Debian manual.

 # echo arch.iso > /dev/sdX 

Offline

#8 2015-07-15 09:40:52

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: Why can I just write the arch iso to a usb drive and it works?

jagan605 wrote:

I do it as instructed in the Debian manual.

 # echo arch.iso > /dev/sdX 

This won't work with sudo, though.

echo arch.iso > sudo tee /dev/sdX > /dev/null

EDIT: And echo won't exactly spit out the content of a file, so...

echo "$(<filename)" | sudo tee /dev/sdX

Last edited by Awebb (2015-07-15 09:46:02)

Offline

#9 2015-07-15 09:53:42

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: Why can I just write the arch iso to a usb drive and it works?

jagan605 wrote:

I do it as instructed in the Debian manual.

 # echo arch.iso > /dev/sdX 
$ echo arch.iso
arch.iso

That'd be true magic, booting on a single line of text. (Not that it would work in the first place, as outlined above. You were looking for a cat instead of an echo.)

Last edited by Alad (2015-07-15 09:55:55)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#10 2015-07-15 12:15:25

jagan605
Member
Registered: 2011-12-04
Posts: 26

Re: Why can I just write the arch iso to a usb drive and it works?

OMG, I was referring to cat.

Offline

#11 2015-07-15 12:33:18

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,417
Website

Re: Why can I just write the arch iso to a usb drive and it works?

OMG, you were referring to cat? wink

The primary reason that this works with archlinux is, of course, that Allan hasn't gotten around to it yet.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#12 2015-07-15 19:56:15

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: Why can I just write the arch iso to a usb drive and it works?

Gusar wrote:

Won't this erase the current content on the stick, like with dd?

Yes, it will.


Jin, Jîyan, Azadî

Offline

#13 2015-07-18 18:40:17

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Re: Why can I just write the arch iso to a usb drive and it works?

Gusar wrote:

Fun fact, on UEFI machines you don't even need dd. You can loop mount the image and simply copy its content to the stick. That's because UEFI will search for EFI/Boot/bootx86.efi on the stick and run that, no need to mess with boot sectors and other stuff that's required for BIOS booting.

I might be doing something wrong, but the above procedure does not work for me. If I mount the iso file and copy its content, i.e. directories "arch  EFI  isolinux  loader", to a (FAT formatted) flashdrive, all I get upon (efi) reboot from the flash is a menu with two items: "EFI Default Loader" and "Reboot Into Firmware". The first runs the loader already installed on the system, the second opens up the efi-interface for configuring the MB.

So neither of them boot from the flashdrive.

This is straying a bit from the original topic, but anybody has a clue what could be wrong? I'm otherwise able to boot e.g. grub in efi mode (when it is on the flash). To be able to prepare an efi bootable flashdrive just from the arch iso would be nice.

Last edited by renergy (2015-07-18 19:04:03)

Offline

Board footer

Powered by FluxBB