I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd
On Thu, 2 Jun 2011, Todd Cary wrote:
To: CentOS mailing list centos@centos.org From: Todd Cary todd@aristesoftware.com Subject: [CentOS] How to format a USB drive?
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Hi Todd.
One way is to install Gparted and look at the USB drive in the GUI.
You can then reformat it to whatever you want in Gparted.
Kind Regards,
Keith Roberts
----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------
Keith Roberts wrote:
How can I determine the current format?
Do I use the mkfs command?
Hi Todd.
One way is to install Gparted and look at the USB drive in the GUI.
Other is to run "mount" or "mount | grep /media" to find out what is /dev/XXX of the USB drive, and its format type.
use of mkfs you can find on the internet, I use GParted, it's easier and safer in GUI.
In both cases first you must unmount ("umount /media/disk") before formating
Ljubomir
Todd,
Todd Cary wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
You can pretty much format it any way you want. fdisk /media/disk, then p, will tell you what it thinks it is; change the type with a t if you want something different. Partition it as you like - it's just a storage medium.
My USB key that I have set up to install CentOS from has a 10M DOS partition, and the rest of the 8G is ext3 (or did I make it ext2 - I forget).
mark
On Thursday, June 02, 2011 11:27:00 AM Todd Cary wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
Ok, so it's mounted on /media/disk; you'll first have to determine what the actual device is (/dev/sdb or similar).
How can I determine the current format?
The mount command will give you this. Example: # mount /dev/mapper/vg_backup670-lv_root on / type ext3 (rw) ...
The / filesystem is mounted as type ext3. Look for your /media/disk in the list; this will also give you the actual device name.
Do I use the mkfs command?
You can partition the USB stick, and if you have a U3-capable stick, like some SanDisk Cruzers, you can re-allocate portions to the emulated CD and the writeable filesystem using the u3-tool package (google it; it's on SourceForge, I think, and I've used it to put a 1.4GB NST ISO onto the CD portion of a SanDisk, as well as enlarging the CD portion to 1.4GB in the first place....)...
On non-U3 sticks, and on the hard disk portion of a U3-capable stick, partitioning is done like any other hard disk. Then you can mkfs like you would any other hard disk. There are filesystems that are easier on flash drives than other types; wikipedia will help you there.
You will need to umount /media/disk first.
In C6 you'll be able to do all of this in the GUI with gnome-disk-utility, aka palimpsest, and do it quickly and smoothly. (I have a box with RHEL6 on it, and the RHEL6 version of palimpsest works very similarly to the Fedora 12+ version, and it has some very nice features, all in a well-integrated interface).
At Thu, 02 Jun 2011 08:27:00 -0700 CentOS mailing list centos@centos.org wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd
Here is a step-by-step explaination (and I am going to give the CLI method -- *I* don't have a clue about how to do with with the point-and-click interface):
Fire up an Terminal window (it should be on the right-click menu under GNome), then in this window type [I will assume you have sudo privs, otherwise you need to be root (it is not recomended that you actually log in as root)]
# Get some information about the disk, includes the physical device name # and its /bin/mount | grep /media/disk # Unmount the disk (be sure to close any open windows relating to the disk) sudo /bin/umount -v /media/disk # Format the disk or partition. Replace <type> with the type you want # (ext2, ext3, vfat, and maybe some others). Replace <mumble> with the # device file reported above. sudo /sbin/mkfs -t <type> /dev/<mumble>
There should be man pages for all of these commands (accessable with the 'man' command):
man mount man umount man mkfs man sudo
Robert Heller wrote:
At Thu, 02 Jun 2011 08:27:00 -0700 CentOS mailing list centos@centos.org wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd
Here is a step-by-step explaination (and I am going to give the CLI method -- *I* don't have a clue about how to do with with the point-and-click interface):
Fire up an Terminal window (it should be on the right-click menu under GNome), then in this window type [I will assume you have sudo privs, otherwise you need to be root (it is not recomended that you actually log in as root)]
# Get some information about the disk, includes the physical device name # and its /bin/mount | grep /media/disk # Unmount the disk (be sure to close any open windows relating to the disk) sudo /bin/umount -v /media/disk # Format the disk or partition. Replace <type> with the type you want # (ext2, ext3, vfat, and maybe some others). Replace <mumble> with the # device file reported above. sudo /sbin/mkfs -t <type> /dev/<mumble>
There should be man pages for all of these commands (accessable with the 'man' command):
man mount man umount man mkfs man sudo
Who is that "sudo" guy you keep writing about: ;-) RHEL, RHEL, RHEL, not debian.
Ljubomir
At Thu, 02 Jun 2011 18:47:59 +0200 CentOS mailing list centos@centos.org wrote:
Robert Heller wrote:
At Thu, 02 Jun 2011 08:27:00 -0700 CentOS mailing list centos@centos.org wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd
Here is a step-by-step explaination (and I am going to give the CLI method -- *I* don't have a clue about how to do with with the point-and-click interface):
Fire up an Terminal window (it should be on the right-click menu under GNome), then in this window type [I will assume you have sudo privs, otherwise you need to be root (it is not recomended that you actually log in as root)]
# Get some information about the disk, includes the physical device name # and its /bin/mount | grep /media/disk # Unmount the disk (be sure to close any open windows relating to the disk) sudo /bin/umount -v /media/disk # Format the disk or partition. Replace <type> with the type you want # (ext2, ext3, vfat, and maybe some others). Replace <mumble> with the # device file reported above. sudo /sbin/mkfs -t <type> /dev/<mumble>
There should be man pages for all of these commands (accessable with the 'man' command):
man mount man umount man mkfs man sudo
Who is that "sudo" guy you keep writing about: ;-) RHEL, RHEL, RHEL, not debian.
Huh? I use CentOS and use sudo. I have never used debian or ubuntu. sudo predates all versions of Linux anyway. I was using it under SunOS (*before* it became Solaris), as well as Ultrix (DECStations) and Irix (SGIs).
Ljubomir _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Robert Heller wrote:
man mount man umount man mkfs man sudo
Who is that "sudo" guy you keep writing about: ;-) RHEL, RHEL, RHEL, not debian.
Huh? I use CentOS and use sudo. I have never used debian or ubuntu. sudo predates all versions of Linux anyway. I was using it under SunOS (*before* it became Solaris), as well as Ultrix (DECStations) and Irix (SGIs).
I know. But you need to setup sudo for users, I never bothered so far. But every Ubuntu manual starts with "sudo...", so I jocked a little, although many users might get "<user> is not in sudoers file.."
Ljubomir
At Thu, 02 Jun 2011 20:36:49 +0200 CentOS mailing list centos@centos.org wrote:
Robert Heller wrote:
man mount man umount man mkfs man sudo
Who is that "sudo" guy you keep writing about: ;-) RHEL, RHEL, RHEL, not debian.
Huh? I use CentOS and use sudo. I have never used debian or ubuntu. sudo predates all versions of Linux anyway. I was using it under SunOS (*before* it became Solaris), as well as Ultrix (DECStations) and Irix (SGIs).
I know. But you need to setup sudo for users, I never bothered so far.
It is one of the *first* things I do when I freshly install Linux (*ANY* distro, both on my machines and anyone else's I set up).
But every Ubuntu manual starts with "sudo...", so I jocked a little, although many users might get "<user> is not in sudoers file.."
Ljubomir _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 6/2/2011 3:04 PM, Robert Heller wrote:
I know. But you need to setup sudo for users, I never bothered so far.
It is one of the *first* things I do when I freshly install Linux (*ANY* distro, both on my machines and anyone else's I set up).
And the first thing I do when I need to change something on a system set up like that is 'sudo su -'... Too lazy to type it more than once.
On 06/02/2011 04:20 PM, Les Mikesell wrote:
On 6/2/2011 3:04 PM, Robert Heller wrote:
I know. But you need to setup sudo for users, I never bothered so far.
It is one of the *first* things I do when I freshly install Linux (*ANY* distro, both on my machines and anyone else's I set up).
And the first thing I do when I need to change something on a system set up like that is 'sudo su -'... Too lazy to type it more than once.
I just learned about su -i, does the same and is shorter.
On Fri, Jun 03, 2011 at 06:52:30AM -0400, Steve Clark wrote:
On 06/02/2011 04:20 PM, Les Mikesell wrote:
And the first thing I do when I need to change something on a system set up like that is 'sudo su -'... Too lazy to type it more than once.
I just learned about su -i, does the same and is shorter.
% su -i su: invalid option -- i Try `su --help' for more information.
You probably meant "sudo -i" :-)
On 06/03/2011 06:56 AM, Stephen Harris wrote:
On Fri, Jun 03, 2011 at 06:52:30AM -0400, Steve Clark wrote:
On 06/02/2011 04:20 PM, Les Mikesell wrote:
And the first thing I do when I need to change something on a system set up like that is 'sudo su -'... Too lazy to type it more than once.
I just learned about su -i, does the same and is shorter.
% su -i su: invalid option -- i Try `su --help' for more information.
You probably meant "sudo -i" :-)
oops - yep.
On 6/3/11 5:56 AM, Stephen Harris wrote:
On Fri, Jun 03, 2011 at 06:52:30AM -0400, Steve Clark wrote:
On 06/02/2011 04:20 PM, Les Mikesell wrote:
And the first thing I do when I need to change something on a system set up like that is 'sudo su -'... Too lazy to type it more than once.
I just learned about su -i, does the same and is shorter.
% su -i su: invalid option -- i Try `su --help' for more information.
You probably meant "sudo -i" :-)
But that is a special case to remember. I like combining things I already knew better than remembering some new special case.
Steve Clark wrote:
On 06/02/2011 04:20 PM, Les Mikesell wrote:
On 6/2/2011 3:04 PM, Robert Heller wrote:
I know. But you need to setup sudo for users, I never bothered so far.
It is one of the *first* things I do when I freshly install Linux (*ANY* distro, both on my machines and anyone else's I set up).
And the first thing I do when I need to change something on a system set up like that is 'sudo su -'... Too lazy to type it more than once.
I just learned about su -i, does the same and is shorter.
I use "su -" to logon as root and have full support (ip address, etc...) and full root path. Then I do what is needed.
Ljubomir
On Thu, Jun 02, 2011 at 08:27:00AM -0700, Todd Cary wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd
To throw a caveat into the works here:
I was reading a while back some articles about the difficulties of using flash drives, which for purposes of this discussion includes, so I'm given to understand, not just SSDs but also usb flash devices. It was pointed out there that many (if not all, may be all, for all I know) of these devices are shipped with a specially tweaked FAT file system (FAT, VFAT, Fat32, whatever the specifics were I don't remember). These specially tweaked filesystems have been modified to take into account characteristics of the flash device, such that partitions may begin in odd places, or the FAT may have only one copy, or may be of a restricted size or in an odd location. All to optimize performance. Once you've reformatted it, you can never again revert to the original condition (unless you've saved a bit-wise image of it with, e.g., dd.)
On 6/2/2011 10:17 AM, fred smith wrote:
On Thu, Jun 02, 2011 at 08:27:00AM -0700, Todd Cary wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd
To throw a caveat into the works here:
I was reading a while back some articles about the difficulties of using flash drives, which for purposes of this discussion includes, so I'm given to understand, not just SSDs but also usb flash devices. It was pointed out there that many (if not all, may be all, for all I know) of these devices are shipped with a specially tweaked FAT file system (FAT, VFAT, Fat32, whatever the specifics were I don't remember). These specially tweaked filesystems have been modified to take into account characteristics of the flash device, such that partitions may begin in odd places, or the FAT may have only one copy, or may be of a restricted size or in an odd location. All to optimize performance. Once you've reformatted it, you can never again revert to the original condition (unless you've saved a bit-wise image of it with, e.g., dd.)
Fortunately, I am using a HD; not a Thumb Drive. Thanks though...
Todd
On Thu, 2 Jun 2011, Todd Cary wrote:
To: CentOS mailing list centos@centos.org From: Todd Cary todd@aristesoftware.com Subject: Re: [CentOS] How to format a USB drive?
On 6/2/2011 10:17 AM, fred smith wrote:
On Thu, Jun 02, 2011 at 08:27:00AM -0700, Todd Cary wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd
To throw a caveat into the works here:
I was reading a while back some articles about the difficulties of using flash drives, which for purposes of this discussion includes, so I'm given to understand, not just SSDs but also usb flash devices. It was pointed out there that many (if not all, may be all, for all I know) of these devices are shipped with a specially tweaked FAT file system (FAT, VFAT, Fat32, whatever the specifics were I don't remember). These specially tweaked filesystems have been modified to take into account characteristics of the flash device, such that partitions may begin in odd places, or the FAT may have only one copy, or may be of a restricted size or in an odd location. All to optimize performance. Once you've reformatted it, you can never again revert to the original condition (unless you've saved a bit-wise image of it with, e.g., dd.)
Fortunately, I am using a HD; not a Thumb Drive. Thanks though...
Hi Todd.
And we all thought it *was* a USB flash drive?
Well I did, did anyone else?
Kind Regards,
Keith Roberts
----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------
On Thursday, June 02, 2011 01:42:32 PM Keith Roberts wrote:
On Thu, 2 Jun 2011, Todd Cary wrote:
Fortunately, I am using a HD; not a Thumb Drive. Thanks though...
And we all thought it *was* a USB flash drive?
Well I did, did anyone else?
I did, but most of the instructions work just as well for a spinning-platter USB drive. I have a pair of those hanging off my laptop now, FWIW.....
One of those assumptions, I guess.
Fortunately, I am using a HD; not a Thumb Drive. Thanks though...
Hi Todd.
And we all thought it *was* a USB flash drive?
Well I did, did anyone else?
Well, I haven't thought about it. I use both frequently. At one point I thought about several partitions on the USB drive, so I could say no.
Ljubomir
On Thursday, June 02, 2011 01:55:35 PM Ljubomir Ljubojevic wrote:
Well, I haven't thought about it. I use both frequently. At one point I thought about several partitions on the USB drive, so I could say no.
But you can have multiple partitions on a USB flash drive, too. They're not necessarily limited to one partition.
Lamar Owen wrote:
On Thursday, June 02, 2011 01:55:35 PM Ljubomir Ljubojevic wrote:
Well, I haven't thought about it. I use both frequently. At one point I thought about several partitions on the USB drive, so I could say no.
But you can have multiple partitions on a USB flash drive, too. They're not necessarily limited to one partition.
Yup, but never bothered with one. Over here max people use is 8GB flash drives, they use it mostly to transfer viruses from one unprotected Windows to another ;-) , there is no point in braking them in half or lesser.
Ljubomir
On Thu, 2 Jun 2011, Lamar Owen wrote:
To: CentOS mailing list centos@centos.org From: Lamar Owen lowen@pari.edu Subject: Re: [CentOS] How to format a USB drive?
On Thursday, June 02, 2011 01:55:35 PM Ljubomir Ljubojevic wrote:
Well, I haven't thought about it. I use both frequently. At one point I thought about several partitions on the USB drive, so I could say no.
But you can have multiple partitions on a USB flash drive, too. They're not necessarily limited to one partition.
Of course you can. I formatted a 16GB USB stick with different partitions.
One thing I noticed, was plugging in the USB drive with it formatted as a default factory drive - Fat32 IIRC - made it automount after plugging it into the USB port. Then I was writing some data to it from Midnight Commander, and got tons of 'Network Error' messages, as mc was trying to write to the drive??
So I dumped the Fat32 partition, and reformatted it to ext2 and ext3 partitions.
Anyone else noticed those sorts of errors writing to a USB flash drive?
Kind Regards,
Keith Roberts
----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------
Why not just use fdisk or gparted?
.-. /v\ L I N U X // \ >Phear the Penguin< /( )\ ^^-^^
Todd Cary wrote:
I have a usb drive, /media/disk and I want to reformat it. There are several questions that come up:
How can I determine the current format?
Do I use the mkfs command?
Many thanks...
Todd