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 -- Ariste Software Petaluma, CA 94952 http://www.aristesoftware.com
On Thu, 2 Jun 2011, Todd Cary wrote:> To: CentOS mailing list <centos at centos.org> > From: Todd Cary <todd at 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] -----------------------------------------------------------------
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 at 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... > > ToddHere 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 -- 978-544-6933 / heller at deepsoft.com Deepwoods Software -- http://www.deepsoft.com/ () ascii ribbon campaign -- against html e-mail /\ www.asciiribbon.org -- against proprietary attachments
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... > > ToddTo 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.) -- ---- Fred Smith -- fredex at fcshome.stoneham.ma.us ----------------------------- "Not everyone who says to me, 'Lord, Lord,' will enter the kingdom of heaven, but only he who does the will of my Father who is in heaven." ------------------------------ Matthew 7:21 (niv) -----------------------------
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.
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.
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 >