LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-31-2020, 02:04 AM   #1
CrazyCatLover
Member
 
Registered: Jan 2014
Posts: 38

Rep: Reputation: Disabled
USB FORMAT


Hi,
I am using Debian. When I plug in a USB, it auto mounts as a media. How do I make it mount as a device cause I need to format it. Thanks.
 
Old 07-31-2020, 02:28 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,875

Rep: Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890Reputation: 4890
you do not need to mount it if you want to format it. Just umount and format.
 
Old 07-31-2020, 02:47 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,999

Rep: Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288Reputation: 3288
Depending on DE, you may need to do that from the terminal. If you use the GUI to eject it, it may destroy the device node as well. Gnome (3) seems to.
 
1 members found this post helpful.
Old 07-31-2020, 03:30 AM   #4
GPGAgent
Member
 
Registered: Oct 2018
Location: Cornwall UK
Distribution: Mint
Posts: 414

Rep: Reputation: 42
try this: https://tecadmin.net/format-usb-in-linux/
 
Old 07-31-2020, 05:57 AM   #5
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 4,487
Blog Entries: 11

Rep: Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570
Devices exist from the moment that the kernel recognises them, which in the case of usb keys is just after you have plugged them in. The kernel recognises the key as a whole (for example it might call it sdb) and also any partitions on it (sdb1, etc). A program called udev will immediately create the corresponding device files (/dev/sdb, /dev/sdb1). From that point onwards, you can format any partition on the device or you can repartition it. These are both operations that are carried out on the raw device file. They have nothing to do with mounting.

If the device or a partition on it contains a filesystem, this can be mounted to access the files that it contains. But you should not try to format it when it is mounted. That leads to data corruption.

A complicating fact is that some desktops automatically mount any filesystems they find on plug-in devices. This is convenient for users but also very confusing to newbies, as it blurs the distinction between a raw device and the files and directories that it contains. In Windows that distinction doesn't really exist; in Linux and all Unixes, it is fundamental. As Pan64 says, if a partition on your devices gets automounted in this way, you must unmount it before you can format it.
 
Old 07-31-2020, 07:24 AM   #6
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,757

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Depending on DE, you may need to do that from the terminal. If you use the GUI to eject it, it may destroy the device node as well. Gnome (3) seems to.
So does KDE IIRC. So you probably have to use the command line to unmount the usb drive before you can format it. A GUI option would be using gparted. Install it with:
Code:
# apt install gparted
Then launch gparted; it will ask for the admin password. Once gparted is open, go to your usb drive partition, right click on it and choose the "Unmount" option. After the usb partition is unmounted, you can format the partition by right clicking on it once again and choose the "Format to" option.
 
Old 07-31-2020, 07:41 AM   #7
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 4,487
Blog Entries: 11

Rep: Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570Reputation: 2570
You see how needlessly complicated these "user-friendly" desktops make things!
 
Old 07-31-2020, 03:22 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,022

Rep: Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147Reputation: 3147
Side note.
"USB, it auto mounts as a media."
You may mean it mounts under /media?
 
Old 07-31-2020, 07:37 PM   #9
mrmazda
Senior Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE, Debian, Knoppix, Mageia, Fedora, others
Posts: 2,617
Blog Entries: 1

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
Or /run/media?
 
Old 07-31-2020, 09:25 PM   #10
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386
Posts: 2,106
Blog Entries: 20

Rep: Reputation: 150Reputation: 150
don't eject it (that's the equivalent of having the CD tray open up to let you pick up the CD). just unmount it (as in the umount command). if you are not using command line and expect to use a GUI formatter, then choose one that knows how to unmount it or find a way to do it in GUI or learn to use command line.
 
Old 07-31-2020, 10:52 PM   #11
CrazyCatLover
Member
 
Registered: Jan 2014
Posts: 38

Original Poster
Rep: Reputation: Disabled
Hi, I managed to unmount it but i cant create a physical volume with it. It mentions like device excluded by a filter, so i check online and was told to use wipefs, but i cant find the package in debian, i read it may be under util-linux which i have already installed. So i have no idea what i should do now?
I am using the debian instructions from below.
https://wiki.debian.org/LVM
 
Old 08-01-2020, 04:11 AM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 14,976
Blog Entries: 9

Rep: Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240
Quote:
Originally Posted by CrazyCatLover View Post
Hi, I managed to unmount it but i cant create a physical volume with it. It mentions like device excluded by a filter, so i check online and was told to use wipefs, but i cant find the package in debian, i read it may be under util-linux which i have already installed. So i have no idea what i should do now?
I am using the debian instructions from below.
https://wiki.debian.org/LVM
Sorry, what are you actually trying to accomplish here?

Please, always show us actual commands issued and full output received.
Tell us everything that happened, not a "Reader's Digest".

PS: bonus points for using CODE tags for command output. See my signature.
 
Old 08-01-2020, 09:46 AM   #13
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 3,684

Rep: Reputation: Disabled
USB drives come pre formatted with a MS Windows file system, which will normally get mounted on insertion, if you have automount on.

In such a case, you can use a GUI disk partitioner to unmount it before re partitioning/putting a file system on it.

Or you can unmount it at the command line first, before re partitioning/putting a filesystem onto it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
format a hard drive (/dev/hda1) in Reiser fs format Linh Linux - General 7 06-17-2009 06:30 AM
use vi to convert linux format to windows format intolinux Linux - Software 2 12-10-2003 10:20 PM
Format Problems Saving Star Office Docs in Word Format kkempter Linux - Software 4 08-27-2003 04:23 PM
Does mke2fs format in FAT32 format? blueleft Linux - General 2 08-09-2003 08:03 AM
About amiga format to linux format? 45pferde Linux - General 0 08-12-2001 07:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:12 PM.

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