iso creation on command line : issues

thedighubs

Member
Nov 21, 2024
73
6
16
dear friends

first of all: at the moment i am not sure if this is going to right sub-forum. Plz set me straight if i am writing this to the "wrong" forum? - Let me know this..

background: What is aimed: what do i want to do:

i am currently trying to create a iso file ( of a linux system on a usb-stick)


so i thought that i cna use this command

Code:
sudo dd bs=4M if=/Videos/eos1.iso of=/dev/sdb status=progress oflag=sync


note: my ISO file is named eos1.iso and is located in the /Videos/ directory, the command to write it to my USB stick would be:

Code:
sudo dd bs=4M if=/Videos/eos1.iso of=/dev/sdb status=progress oflag=sync

belive it or not: it does not work.

this oneliner - this does not work

Code:
ubuntu@T420s:~$ sudo dd bs=4M if=/Videos/eos1.iso of=/dev/sdb status=progress oflag=sync


well - a the moment i wonder what is missing - what i need to do and get this working



dd: could not open this '/Videos/eos1.iso' - i could no open either the folder or the file - on your system
ubuntu@T420s:~$


Look forward to hear from you

greetings




updaste: i corrected the path so i guess - now it works.


see - that i have changed the path i added the " ~" - and i guess that this made the trick
look forward to hear from you



btw: which command is the best and most effective to check the result


a lsblk

b. fdisk -l


Code:
sdb                         8:16   1   7,5G  0 disk
├─sdb1                      8:17   1   2,6G  0 part
└─sdb2                      8:18   1   162M  0 part
sr0                        11:0    1  1024M  0 rom
 
Last edited:

manly

Lifer
Jan 25, 2000
12,780
3,571
136
Hopefully you didn't want anything on that USB flash drive, because you overwrote it. I suppose that's intentional but originally you stated you're trying to create an ISO file (which is the opposite action).

dd is a great Unix command, but requires extremely careful use.

Since you don't understand how the "~" affects the path, I would encourage you to read a good Linux CLI tutorial. For example, this book:

 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,521
4,387
75
This reminds me of a story. Once I discovered that writing stuff to /dev/snd, with sudo, would make noise on my speaker, and reading from /dev/snd would record from my microphone. (I don't think this works with modern Linuxes; the sound system is too complex.) Anyway, I was happily recording stuff and writing to /dev/snd. Then my hands automatically typed /dev/sda instead.

Well, the good news was there was a partition at the beginning of the disk meant for restoring the original OS. It was trashed, but I didn't need it. The bigger problem was I had overwritten my "master boot record", or MBR. It took me several days, but I found a way to rebuild my MBR without reinstalling.

The moral I take away from the story is, always put an unimportant partition, like swap, at the beginning of your main disk, so if something somehow starts overwriting your disk you have a chance to stop it before major damage is done.
 

thedighubs

Member
Nov 21, 2024
73
6
16

want to create a iso on a usb-stick.​


hello Manly hello Ken_g6
This reminds me of a story. Once I discovered that writing stuff to /dev/snd, with sudo, would make noise on my speaker, and reading from /dev/snd would record from my microphone. (I don't think this works with modern Linuxes; the sound system is too complex.) Anyway, I was happily recording stuff and writing to /dev/snd. Then my hands automatically typed /dev/sda instead.
workin on the command line is sometimes a bit tricky - especially for me - i am new to this topic
Well, the good news was there was a partition at the beginning of the disk meant for restoring the original OS. It was trashed, but I didn't need it. The bigger problem was I had overwritten my "master boot record", or MBR. It took me several days, but I found a way to rebuild my MBR without reinstalling.


well i think i make some mistakes - in the "naming"

so just see the preliminary conditions
i checked with lsblk

see `enter code here`

Gerät Boot Anfang Ende Sektoren Größe Kn Typ
/dev/sdb1 * 64 60620799 60620736 28,9G c W95 FAT32 (LBA)
ubuntu@T420s:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 55,4M 1 loop /snap/core18/2846
loop2 7:2 0 55,4M 1 loop /snap/core18/2855
loop3 7:3 0 63,7M 1 loop /snap/core20/2496
loop4 7:4 0 63,7M 1 loop /snap/core20/2434
loop5 7:5 0 73,9M 1 loop /snap/core22/1748
loop6 7:6 0 73,9M 1 loop /snap/core22/1722
loop7 7:7 0 93,6M 1 loop /snap/featherpad/1070
loop8 7:8 0 257,9M 1 loop /snap/firefox/5783
loop9 7:9 0 349,7M 1 loop /snap/gnome-3-38-2004/143
loop10 7:10 0 257,8M 1 loop /snap/firefox/5836
loop11 7:11 0 505,1M 1 loop /snap/gnome-42-2204/176
loop12 7:12 0 516M 1 loop /snap/gnome-42-2204/202
loop13 7:13 0 91,7M 1 loop /snap/gtk-common-themes/1535
loop14 7:14 0 752,9M 1 loop /snap/pycharm-community/439
loop15 7:15 0 822,3M 1 loop /snap/pycharm-community/457
loop16 7:16 0 12,9M 1 loop /snap/snap-store/1113
loop17 7:17 0 12,2M 1 loop /snap/snap-store/1216
loop18 7:18 0 44,4M 1 loop /snap/snapd/23545
loop19 7:19 0 568K 1 loop /snap/snapd-desktop-integration/253
loop20 7:20 0 321,1M 1 loop /snap/vlc/3721
loop21 7:21 0 500K 1 loop /snap/snapd-desktop-integration/178
loop22 7:22 0 44,4M 1 loop /snap/snapd/23771
loop23 7:23 0 116,8M 1 loop /snap/zotero-snap/104
loop24 7:24 0 321,1M 1 loop /snap/vlc/3777
loop25 7:25 0 116,7M 1 loop /snap/zotero-snap/98
sda 8:0 0 119,2G 0 disk
├─sda1 8:1 0 1G 0 part /boot/efi
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 116,2G 0 part
└─ubuntu--vg-ubuntu--lv
253:0 0 116,2G 0 lvm /var/snap/firefox/common/host-hunspell
/
sdb 8:16 1 28,9G 0 disk
└─sdb1 8:17 1 28,9G 0 part /media/ubuntu/71BE-0530
sr0 11:0 1 1024M 0 rom


well the question is: should i name the target sdb or sdb1 ?


susequently : is this a good command

ubuntu@T420s:~$ sudo dd bs=4M if=~/Videos/eos2.iso of=/dev/sdb status=progress oflag=sync

for creating the iso on a usb?


well the question is should i use sdb when, it looks like, i should be using sdb1.

in other words should i try this:

sudo rsync -av --progress /home/ubuntu/Dokumente/ /media/ubuntu/sdb1

or

ubuntu@T420s:~$ sudo dd bs=4M if=~/Videos/eos2.iso of=/dev/sdb1 status=progress oflag=sync

well sdb or sdb1 this is the question here.

look forrward to hear from you
 

thedighubs

Member
Nov 21, 2024
73
6
16
update:

if we have with

lsblk
something like so..:

Code:
sda               8:0    0 119,2G  0 disk
├─sda1            8:1    0     1G  0 part /boot/efi
├─sda2            8:2    0     2G  0 part /boot
└─sda3            8:3    0 116,2G  0 part
  └─ubuntu--vg-ubuntu--lv
                253:0    0 116,2G  0 lvm  /var/snap/firefox/common/host-hunspell
                                          /
sdb               8:16   1  28,9G  0 disk
└─sdb1            8:17   1  28,9G  0 part /media/ubuntu/71BE-0530
sr0              11:0    1  1024M  0 rom

my command could be so

Code:
sudo dd bs=4M if=/Videos/eos2.iso of=/dev/sdb1 status=progress oflag=sync

which leads to

Code:
                                                    /
sdb                         8:16   1  28,9G  0 disk
└─sdb1                      8:17   1  28,9G  0 part /media/ubuntu/EOS_202502
sr0                        11:0    1  1024M  0 rom
ubuntu@T420s:~$

regarding the sdb and the sdb1

but i guess that if i use sdb it will overwrite the device; ie. the input & all data (inc. metadata) will be written to the new device; so if the source [ISO] was bootable; the sdb device will also be bootable. If we write to a partition (sdb1) then we 'll have a copy there; but any metadata won't exist & even if source was bootable (metadata is hidden inside partition); the copy on sdb1 will NOT be bootable unless we create/have boot code that will perform those functions. conclusio: Both are correct (just different!); it'll depend what we trying to achieve as to which will suit our needs


update: - i have issues with the recognition of the usb-stick with the iso -
note: its the Lenovo-Thinkpad X 220







and this one








update:



very interesting
: well its somewhat annoying - each time i want to write the stuff to sdb - it turns out to land on sdb1 - i am pulling my hear.


Code:
                                                    /
sdb                         8:16   1  28,9G  0 disk 
└─sdb1                      8:17   1  28,9G  0 part /media/ubuntu/EOS_202502
sr0                        11:0    1  1024M  0 rom  
ubuntu@T420s:~$


well generally i think: (theoretically) should i continue with the command

Code:
sudo mkfs.vfat /dev/sdb


Now i think that i have to mount our freshly created filesystem:

Code:
sudo mkdir -p /media/ubuntu/sdb
sudo mount /dev/sdb1 /media/ubuntu/sdb/

... if so: then i would / should go subsequently like so: i ll have to check the contents to see if it?s empty:


Code:
ls -al /media/ubuntu/sdb/


well that said: Now i guess that i have done all the necessary steps to get the usb-stick ready - so subsequently our rsync command should actually work:

Code:
sudo dd bs=4M if=~/Videos/eos2.iso of=/dev/sdb status=progress oflag=sync

well - but honestly - allmost every time i try to write to sdb - it turns out to land on sdb1.

well i have to re-check and probably start over from the very beginning - that means - probably i should

a. erase the stick and work with dd and
b. start over again


again - have a great day..

greetings
 
Last edited:

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,521
4,387
75
I think we've all missed an important point here. You're trying to copy a .iso (an image of a CD-ROM or DVD-ROM) to a USB stick. I assume it's a Linux image and you want the stick to be able to boot Linux?

The thing is, .iso format is very different from USB format. Same files, different arrangement. DD is a Dumb Duplicator - it'll copy the .iso in the original .iso format and won't ask questions. To create a bootable USB from a .iso file you need different software.

Most Linux systems come with a utility to write a .iso image to USB. Mint has a USB Image Writer. If you have a Windows system, apparently the software to use is called Rufus.
 

JackMDS

Elite Member
Super Moderator
Oct 25, 1999
29,524
412
126
The 6 Best Tools to Create a Bootable USB From an ISO in Linux
  • Ventoy. Ventoy is an open-source tool for creating bootable USB drives that supports a wide variety of Linux distributions. ...
  • UNetbootin. ...
  • Rufus. ...
  • Etcher (BalenaEtcher) ...
  • dd (Disk Dump) ...
  • Fedora Media Writer.
 

manly

Lifer
Jan 25, 2000
12,780
3,571
136
I think we've all missed an important point here. You're trying to copy a .iso (an image of a CD-ROM or DVD-ROM) to a USB stick. I assume it's a Linux image and you want the stick to be able to boot Linux?

The thing is, .iso format is very different from USB format. Same files, different arrangement. DD is a Dumb Duplicator - it'll copy the .iso in the original .iso format and won't ask questions. To create a bootable USB from a .iso file you need different software.

Most Linux systems come with a utility to write a .iso image to USB. Mint has a USB Image Writer. If you have a Windows system, apparently the software to use is called Rufus.
That's not even the fundamental point.

OP is confused on what a block device is, vs a filesystem partition. So they have two options: use a user-friendly tool like Balena Etcher or spend some time learning more about Linux so that this stuff begins to make sense. Copying and pasting commands from the web without understanding what it means is not good, and esp. not when the command is dd .

I believe in many cases, dd can actually write an ISO file out to a USB flash drive successfully. That should work for most bootable Linux ISOs.

The two examples he gave of rsync and dd are wildly different, so OP has to decide if he wants to invest time into learning the CLI. I think it's worthwhile, but just for example, 99% of macOS users probably never use the CLI.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |