I used dd to create my key - it doesn't work - hint

A 5 star hangout for overworked and underpaid system admins.
Post Reply
lightman47
Posts: 1224
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

I used dd to create my key - it doesn't work - hint

Post by lightman47 » 2020/11/11 18:19:14

If I hadn't had a usb key with a light on it I'd never have known that you may be removing the usb before the writing is complete!

I just created a key from an iso and, as always, used dd to accomplish this. When dd 'returned the command line prompt' I thought the imaging was complete and went to pull out the key - but its led was still blinking/busy. It took another 30-45 seconds to complete the image 'burn' !

Apparently dd caches the image, then exits - while some other process actually performs the 'burn'. I wonder if some permutation of the eject command would help if appended to the dd command as in example:

sudo dd if=myisoimage of=/dev/sd? status=progress;sudo eject /dev/sd?
Last edited by lightman47 on 2020/11/11 19:09:43, edited 1 time in total.
Remember - importing/building packages will likely "byte you in the butt" come update time, long after you'd forgotten you did that! Use repos whenever possible.

MartinR
Posts: 620
Joined: 2015/05/11 07:53:27
Location: UK

Re: I used dd to create my key - it doesn't work !

Post by MartinR » 2020/11/11 19:04:13

It's not dd that is doing the caching but the operating system itself. Unless you take special steps a write completes when the IO packet has been moved into system space. The actual writing from the buffers to disk takes place as resources are available. To force writes to complete you can use the sync command which synchronises all disks. Old UNIX hands learnt to do "# sync ; sync" just to be certain. If you dismount the USB properly then it will be sync'ed and safe, if you just yank it out you may get "burnt" yourself!

lightman47
Posts: 1224
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: I used dd to create my key - it doesn't work !

Post by lightman47 » 2020/11/11 19:08:42

Ahhh! I can do that!
Thank you!
Remember - importing/building packages will likely "byte you in the butt" come update time, long after you'd forgotten you did that! Use repos whenever possible.

User avatar
TrevorH
Forum Moderator
Posts: 29915
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: I used dd to create my key - it doesn't work - hint

Post by TrevorH » 2020/11/11 19:22:04

or tell dd to do it: oflag=direct or conv=fdatasync, probably the first I think is better for writing to a USB stick.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

lightman47
Posts: 1224
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: I used dd to create my key - it doesn't work - hint

Post by lightman47 » 2020/11/11 19:24:59

wow - am thinking of an 'alias' for dd

Thank you both
Remember - importing/building packages will likely "byte you in the butt" come update time, long after you'd forgotten you did that! Use repos whenever possible.

Post Reply

Return to “CentOS Social”