LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-25-2021, 08:31 PM   #1
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,432

Rep: Reputation: 110Reputation: 110
I can't format a USB stick


In fact, I want to write an ISO image to it. But bear with me.

I insert the USB stick and it automounts to /dev/sdc1.

I don't want those contents anymore. I am ready to overwrite it all.

I umount /dev/sdc1.

Code:
# dd if=/image.iso of=/dev/sdc
dd: failed to open '/dev/sdc': No medium found
I reinsert the USB stick.
It automounts to /dev/sdc1.
I umount /dev/sdc1.

Code:
# dd if=/image.iso of=/dev/sdc
dd: failed to open '/dev/sdc': No medium found
I'm stuck.
 
Old 10-25-2021, 08:36 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
This is a shot in the dark, but . . . .

/dev/sdc is the device.

/dev/sdc1 is the partition containing the files on the device.

Try pointing your command a /dev/sdc1.
 
Old 10-25-2021, 08:43 PM   #3
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,432

Original Poster
Rep: Reputation: 110Reputation: 110
Thanks, but no. An image must be written to the device. I've done that many times over the years.

For example,
https://www.system-rescue.org/Instal...-memory-stick/
 
Old 10-25-2021, 09:10 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Try mount command just to check if something else is going on or use Gparted/Disks.

Try sudo but that should reply a permission issue.
 
1 members found this post helpful.
Old 10-25-2021, 09:32 PM   #5
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,432

Original Poster
Rep: Reputation: 110Reputation: 110
I've finally made it.

Insert the stick and let it automount. Whatever.
Run cfdisk /dev/sdc
Delete all partitions and write changes.
Remove and reinsert stick.
Run cfdisk /dev/sdc again, create one Linux partition and write changes.
Run dd to write the image.
Wait until it finishes.
The stick will automount again. Whatever.
Shake head in disgust.
Unmount /dev/sdc1 and /dev/sdc2 (yes, I had both. go figure)
Remove the stick.
 
Old 10-25-2021, 11:29 PM   #6
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,805
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
If a USB stick has a LABELs on its filesystems, for each that has an entry in fstab, with a noauto option, that filesystem won't be automounted. You can use that same set of LABELs for as many sticks as you please, and none will automount.

To eliminate the content of a stick, you don't need a partitioner. Simply use dd to write nonsense, nulls or zeros to the first sector(s). After removal, there won't be any filesystems to automount on next insertion.
 
1 members found this post helpful.
Old 10-25-2021, 11:48 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by lucmove View Post
automounts
(...)
automounts
Quote:
Originally Posted by lucmove View Post
automount
(...)
automount
The joys of "user friendly" desktop environments.

Shot in the dark(*): if you use the GUI to unmount, maybe it also "eject"s the USB. Then it doesn't show up under /dev anymore.

(*) your descriptions show your frustration but not much information.
 
Old 10-26-2021, 03:30 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,836

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
you ought to switch off that automounter in such cases.
 
Old 10-28-2021, 03:39 PM   #9
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by ondoho View Post
The joys of "user friendly" desktop environments.

Shot in the dark(*): if you use the GUI to unmount, maybe it also "eject"s the USB. Then it doesn't show up under /dev anymore.

(*) your descriptions show your frustration but not much information.
Nautilus on fedora does exactly that. It both dismounts the file systems and ejects the device.

In order to use dd and write the iso to the usb drive it is necessary, from the command line, to check what is mounted, use umount to unmount the partition(s) from the usb device that may have automounted, then use dd to write the iso to the device. Partitions created do not automount again until the device is unplugged and plugged back in.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to differentiate a mounted usb stick vs plugged in but not mounted usb stick. andrewysk Linux - Newbie 22 04-05-2021 02:42 PM
Hauppauge wintv-hvr h006 - dvb-t tuner - usb-stick - hybrid tv stick Xeratul Linux - Hardware 5 12-23-2012 09:47 AM
[SOLVED] can't mount usb stick in ntfs format porphyry5 Slackware - Installation 2 03-29-2011 12:54 PM
LXer: Installing "Sugar on a stick" (Strawberry Release) On A USB Stick LXer Syndicated Linux News 0 08-04-2009 03:50 PM
mount/umount usb stick - PQI Intelligent Stick 2.0 sandbag Linux - Software 5 05-06-2005 11:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration