Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
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.
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);
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.