LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-08-2008, 01:02 AM   #1
Tapasi
LQ Newbie
 
Registered: Aug 2007
Posts: 1

Rep: Reputation: 0
format memory stick


Dear All,
I want to format memory stick(pen drive).
So, what is the command ?
Suggestions needed.
Thanks in advance.
Regards.
Tapasi
 
Old 02-08-2008, 01:49 AM   #2
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
Once you plugged your pen drive, make sure it is mounted or not.

use "fdisk -l" which will show the list of disk in your linux box.
Your USB may be there as a " sda/sdb/sdc/sdd" (either one). You can verify yourself with the size in MB .

The you need to mount it to a directory.
mkdir /ZAMO
mount /dev/sda1 /ZAMO (am considering my USB as sda)
cd ZAMO
ls
.....Verify your data is here. If ok continue
cd ..
mkdosfs /dev/sda1 (if you want a dos FS)
mke2fs -j /dev/sda1 (if you want ext3 FS)

All the best. This is for Fedora or redhat.
 
Old 02-08-2008, 07:26 AM   #3
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Do not mount the disk before formatting. Especially, do not have the disk mounted during the formatting.

Also, keep in mind that on newer kernels, many devices appear on /dev/sd*, so double-check which device you are formatting -- it would be bad to do that to your hard drive.
 
Old 02-08-2008, 07:34 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,922
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

Quote:
Originally Posted by Tapasi View Post
Dear All,
I want to format memory stick(pen drive).
So, what is the command ?
Suggestions needed.
Thanks in advance.
Regards.
Tapasi
You don't mount the flash to format/partition it.

You first would partition the device using 'fdisk /dev/sdx' (where x is the device a,b,c,d). Partition as you desire, make sure to select the partition type for the device partitions.

You can then run 'mkfs ' on the device (note the underlined portion);
Quote:
excerpt from 'man mkfs';
MKFS(8)

NAME
mkfs - build a Linux file system

SYNOPSIS
mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ]

DESCRIPTION
mkfs is used to build a Linux file system on a device, usually a hard
disk partition. filesys is either the device name (e.g. /dev/hda1,
/dev/sdb2) or the mount point (e.g. /, /usr, /home) for the file sys-
tem. blocks is the number of blocks to be used for the file system.

The exit code returned by mkfs is 0 on success and 1 on failure.

In actuality, mkfs is simply a front-end for the various file system
builders (mkfs.fstype) available under Linux
. The file system-specific
builder is searched for in a number of directories like perhaps /sbin,
/sbin/fs, /sbin/fs.d, /etc/fs, /etc (the precise list is defined at
compile time but at least contains /sbin and /sbin/fs), and finally in
the directories listed in the PATH enviroment variable. Please see the
file system-specific builder manual pages for further details.
You should 'man commands' when in question.

Last edited by onebuck; 02-08-2008 at 07:36 AM. Reason: repair
 
  


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
USB memory stick - badblocks - how to format? mazzo Linux - Hardware 6 10-29-2008 12:26 AM
SD card & USB stick format chaos JohnKFT Slackware 5 10-04-2006 06:31 PM
USB memory, Compact Flash, Memory Stick energiza Linux - Hardware 2 08-22-2006 09:29 PM
Missing memory in USB stick, flash memory, removable hd etc bamboo_spider Linux - Newbie 3 06-14-2006 05:39 PM
memory stick / CF memory card reader X-dazed Linux - Newbie 1 01-21-2003 12:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:31 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