27

The last paragraph of the SliTaz 3.0 Release Notes says the following about the liveCD:

The ISO image now uses a 'hybrid' system: it can also be copied onto an USB stick without formating it (using dd).

Does anyone know how to do this?

2
  • 4
    DEAR GOD BE CAREFUL WITH dd! It's nicknamed disk destroyer for a reason.
    – Rob
    Oct 29, 2011 at 20:49
  • @Rob Can you list the dos and donts please? I would hate to waste my drive trying to make it bootable. Dec 12, 2015 at 12:42

4 Answers 4

41

dd if=/path/to/your/isofile of=/your/usb/disk bs=8M status=progress try this.


updated as @Kimvais and @Kelly Bang suggested

8
  • 2
    @weis26: You can, ~ is just replace with the current users home directory path. Use it if either the if or of paths are in your home directory sure... Oct 29, 2011 at 10:20
  • 2
    @weis26 Depends on whether you want to use a relative path or absolute path. By the way, using dd would make your usb device read-only and to make it a 'normal' usb device you shall re-partition the device.
    – starrify
    Oct 29, 2011 at 10:21
  • 11
    bs=8M or so would speed this up quite a bit... also, should mention using mount to see what disk is mounted at /media/83...
    – Kimvais
    Oct 29, 2011 at 10:26
  • 1
    @starrify - I can't figure out what you mean by saying dd "would make your usb device read-only". dd does not change capabilities of devices, it just shoves data from input to output. Sep 22, 2017 at 13:43
  • 1
    I would also add status=progress so you can see where it's up to
    – Kelly Bang
    Jun 13, 2020 at 16:37
9

If you want to be able to view the progress or get an ETA, you can add Pipe View (pv) into the mix, e.g.:

dd if=<path to input file> | pv -s <size e.g. 1377M> | dd of=<path to target device>

This will give output like:

850MiB 0:05:18 [6.44MiB/s] [===================> ] 61% ETA 0:03:16

4
  • 1
    If you have pv then pv /path/to/input/file > /path/to/target/device is already enough Apr 11, 2018 at 7:32
  • 3
    One of the options in dd is 'status=progress' to get periodic transfer statistics.
    – user65913
    Apr 25, 2018 at 14:29
  • @Owen Pauling I don't understand the "size" argument for pv. You throw out 1377M out of nowhere. What is this supposed to represent ? the size of the file in if= ? So that means we must always verify and hardtype the size manually ? And what happens if you don't put the corresponding size then ?
    – Atralb
    Sep 10, 2020 at 4:50
  • @Atralb yes it's the size of the input file. Without it you cannot get the progress percentage. This answer is a bit outdated anyway - I would use the status=progress option on dd now, then you don't need to type the file size. Sep 15, 2020 at 14:35
6

Note: This is a generic, universal approach that should work on almost any *nix system. If you're having trouble with other recommendations, then give this one a try. So you want to run dd (disk destroyer)? Before attaching your block device, cat /proc/partitions; then attach your device and again cat /proc/partitions. The difference will indicate your target device. If there's no difference then you lack the correct driver to recognize it or have a hardware fault.

Here's what mine looks like on my laptop, before and after, respectively:

jcholsap@T430s:~$ cat /proc/partitions 

major minor  #blocks  name
8        0  117220824 sda
8        1  117219328 sda1
11       0    1048575 sr0
253      0  109109248 dm-0
253      1    8077312 dm-1

jcholsap@T430s:~$ cat /proc/partitions 

major minor  #blocks  name
8        0  117220824 sda
8        1  117219328 sda1
11       0    1048575 sr0
253      0  109109248 dm-0
253      1    8077312 dm-1
8       16   30670848 sdb

Use the third column, size in kilobytes, to verify your block device. If you're nervous, and you should be, you can further verify your device with dmesg. Here it is on my laptop:

jcholsap@T430s:~$ dmesg | tail -30
[   10.197383] thinkpad_acpi: EC reports that Thermal Table has changed
[   34.599234] random: crng init done
[   35.133277] rfkill: input handler disabled
[ 9737.190954] usb 4-2: new SuperSpeed USB device number 2 using xhci_hcd
[ 9737.211756] usb 4-2: New USB device found, idVendor=0781, idProduct=5580
[ 9737.211762] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9737.211765] usb 4-2: Product: Extreme
[ 9737.211768] usb 4-2: Manufacturer: SanDisk
[ 9737.211770] usb 4-2: SerialNumber: AA010507161254310422
[ 9737.244492] usb-storage 4-2:1.0: USB Mass Storage device detected
[ 9737.245540] scsi host6: usb-storage 4-2:1.0
[ 9737.245746] usbcore: registered new interface driver usb-storage
[ 9737.247465] usbcore: registered new interface driver uas
[ 9738.259485] scsi 6:0:0:0: Direct-Access     SanDisk  Extreme          0001 PQ: 0 ANSI: 6
[ 9738.260340] sd 6:0:0:0: Attached scsi generic sg2 type 0
[ 9738.260698] sd 6:0:0:0: [sdb] 61341696 512-byte logical blocks: (31.4 GB/29.3 GiB)
[ 9738.260919] sd 6:0:0:0: [sdb] Write Protect is off
[ 9738.260925] sd 6:0:0:0: [sdb] Mode Sense: 53 00 00 08
[ 9738.261142] sd 6:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 9738.267727] sd 6:0:0:0: [sdb] Attached SCSI removable disk
[ 9738.496445] UDF-fs: warning (device sdb): udf_load_vrs: No anchor found
[ 9738.496450] UDF-fs: Scanning with blocksize 512 failed
[ 9738.505586] UDF-fs: warning (device sdb): udf_load_vrs: No anchor found
[ 9738.505589] UDF-fs: Scanning with blocksize 1024 failed
[ 9738.519311] UDF-fs: warning (device sdb): udf_load_vrs: No anchor found
[ 9738.519324] UDF-fs: Scanning with blocksize 512 failed
[ 9738.528153] UDF-fs: warning (device sdb): udf_load_vrs: No anchor found
[ 9738.528157] UDF-fs: Scanning with blocksize 1024 failed
[ 9738.533493] UDF-fs: INFO Mounting volume 'UDF Volume', timestamp 2011/04/12 09:38 (1000)
[10100.854101] perf: interrupt took too long (2519 > 2500), lowering kernel.perf_event_max_sample_rate to 79250

There's all the details of my thumb drive. Ah, now I'm convinced I have the right device!

But my attached device may have auto-mounted. For dd, that's a problem. So to be certain, let's unmount it with umount (note the difference in spelling). I'll run the command twice because the error message let's me know it succeeded:

jcholsap@T430s:~$ sudo umount /dev/sdb
jcholsap@T430s:~$
jcholsap@T430s:~$ sudo umount /dev/sdb
umount: /dev/sdb: not mounted.

Now, because everything in Linux is treated as a file, dd calls the target block device, in my case /dev/sdb, an output file. So, the option-argument pair to use, here for my thumb drive, with the dd command is of=/dev/sdb. You want to get this right or else dd could mean disk destroyer for you. Here it is on my laptop:

jcholsap@T430s:~$ sudo dd of=/dev/sdb if=/home/jcholsap/centos7.iso bs=4M

There's no output from the running dd command. You'll just get a blinking cursor until it finishes, which can be a long time. If you interrupt the process then you'll have a partial image copy - probably not what you wanted.

SEE ALSO Full documentation at: http://www.gnu.org/software/coreutils/dd or available locally via: info '(coreutils) dd invocation'

1
  • 1
    But there is output if you use status=progress
    – Kelly Bang
    Jun 13, 2020 at 16:35
0

Hi, this one help !

  1. Unmount
  2. Just this !

Run one of the following commands, replacing /dev/disk/by-id/usb-My_flash_drive with your drive, e.g. /dev/disk/by-id/usb-Kingston_DataTraveler_2.0_408D5C1654FDB471E98BED5C-0:0

NO ! NO ! NO! this - /dev/sdb

https://wiki.archlinux.org/title/USB_flash_installation_medium

Using basic command line utilities

This method is recommended due to its simplicity and universal availability, since these tools are part of coreutils (pulled in by the base meta package).

Find out the name of your USB drive with ls -l /dev/disk/by-id/usb-* and check with lsblk to make sure that it is not mounted.

Run one of the following commands, replacing /dev/disk/by-id/usb-My_flash_drive with your drive, e.g. /dev/disk/by-id/usb-Kingston_DataTraveler_2.0_408D5C1654FDB471E98BED5C-0:0. (Do not append a partition number, so do not use something like /dev/disk/by-id/usb-Kingston_DataTraveler_2.0_408D5C1654FDB471E98BED5C-0:0-part1 or /dev/sdb1):# cat path/to/archlinux-version-x86_64.iso > /dev/disk/by-id/usb-My_flash_drive

using cp(1):

cp path/to/archlinux-version-x86_64.iso /dev/disk/by-id/usb-My_flash_drive

using dd:

dd bs=4M if=path/to/archlinux-version-x86_64.iso of=/dev/disk/by-id/usb-My_flash_drive conv=fsync oflag=direct status=progress

using tee:

tee < path/to/archlinux-version-x86_64.iso > /dev/disk/by-id/usb-My_flash_drive

using pv:

pv path/to/archlinux-version-x86_64.iso > /dev/disk/by-id/usb-My_flash_drive

1
  • 1
    Why all these bold characters, they make your answer unreadable.
    – Toto
    Mar 25 at 20:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .