LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-02-2008, 03:01 PM   #1
Dandy1
LQ Newbie
 
Registered: May 2008
Location: Cincinnati, Oh
Distribution: Xubuntu on USB-live
Posts: 8

Rep: Reputation: 0
Question partiton a USB pendrive..


Can you partiton a USB pendrive from linux or windows..? & what is the syntax to do it..??

Tanks, Dandy1
 
Old 05-02-2008, 04:16 PM   #2
Okie
Senior Member
 
Registered: Mar 2002
Location: Oklahoma
Posts: 1,154

Rep: Reputation: 184Reputation: 184
i use cfdisk to partition usb memory sticks, NEVER use a disk tool to partition or format anything that is mounted always umount it first!, if you want to share the data with windows PCs then FAT32 (vfat) (0B in cfdisk) will be necessary, but if you intend to only use it with linux then ext2 will do fine (journaling not necessary)...
 
Old 05-02-2008, 04:38 PM   #3
phr33k
LQ Newbie
 
Registered: Mar 2008
Posts: 4

Rep: Reputation: 0
Well, for a USB pendrive, a standard FAT format is perfect for those sizes of drives. The only time that would change is if your drive is larger than 4GB.
 
Old 05-02-2008, 05:02 PM   #4
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
You can do this in Linux just fine and mount the partition like normal but in windows it will only ever see the first partition on the drive. The windows partition software will also not let you create multiple ones.

The reason is windows classifies it as a removable device or flash media.
 
Old 05-02-2008, 10:14 PM   #5
newtovanilla
Member
 
Registered: Apr 2008
Posts: 267

Rep: Reputation: 30
"& what is the syntax to do it..??"

I would like to know how to do this too. Does someone know the command syntax to format with Linux native for a 1GB and 4GB USB pen drive? I an new to Linux and I have messed up so much already trying to get things to work.
 
Old 05-02-2008, 10:16 PM   #6
newtovanilla
Member
 
Registered: Apr 2008
Posts: 267

Rep: Reputation: 30
I found this on the web:

http://sathyasays.com/2007/06/13/for...sing-terminal/

Quote:
Insert your USB pen drive. Let it get detected and mounted. Open Terminal. Type The Following commands
1. dmesg |tail –> here the ‘|’ key is the pipe, ie, the key before the backspace key(the upper one, so press shift)
You’ll get something like

sathya@shaman:~$ dmesg |tail
[ 9921.681164] sda: Write Protect is off
[ 9921.681174] sda: Mode Sense: 23 00 00 00
[ 9921.681178] sda: assuming drive cache: write through
[ 9921.709138] SCSI device sda: 4030464 512-byte hdwr sectors (2064 MB)
[ 9921.720951] sda: Write Protect is off
[ 9921.720963] sda: Mode Sense: 23 00 00 00
[ 9921.720967] sda: assuming drive cache: write through
[ 9921.721225] sda:
[ 9921.727896] sd 0:0:0:0: Attached scsi removable disk sda
[ 9921.744187] sd 0:0:0:0: Attached scsi generic sg0 type 0
Note the terms in bold. In your system it will be different, maybe sdb or something. Whatever it may be, make sure to substitute it in the commands below, else your hard disk may get formatted.

2. Unmount your pen drive by using
sudo umount /dev/sda (In your case, please substitute sda with the appropriate device, listed above.

3. use the mkfs.vfat command to format to FAT32 filesystem, or mkfs.ext3 to format to ext3 filesystem
sudo mkfs.vfat -n ‘Label’ -I /dev/sda Replace Label with the name you want the pen drive to have.

4. That’s it! When done formatting, you’ll be returned to the prompt
sathya@shaman:~$ mkfs.vfat -n ’sathya’ -I /dev/sda
mkfs.vfat 2.11 (12 Mar 2005)
sathya@shaman:~$

Remove and insert the pen drive to have mounted again!
 
Old 05-06-2008, 05:30 PM   #7
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
Quote:
Originally Posted by newtovanilla View Post
"& what is the syntax to do it..??"

I would like to know how to do this too. Does someone know the command syntax to format with Linux native for a 1GB and 4GB USB pen drive? I an new to Linux and I have messed up so much already trying to get things to work.
It depends on the file system you wish to use. Normally as long as you have everything built into the kernel that you need ( most distros do ) you will get a new device aka /dev/sda unless of course you are using a serial ata drive then /dev/sda would be the internal drive.


lets break down that shal we.

/dev ( this is where all our devices should live )
sda ( hmmm ok s in there stands for serial and d stands for drive )
( the last letter indicates the number of the disks in the system)

so /dev/sdc would indicate this is the 3rd serial device in the system.

now we cannot mount a whole disk but rather need to mount a partition well thats easy because we just add the number of the partition we want to mount on the disk thus /dev/sda1 is the first partition on the first serial device on the system.


if you create two partitions on a thumb drive the commands would be easy enough.

say the pen drive is /dev/sda

use cfdisk to create the 2 partitions ( if you dont know how google it )
so we should have /dev/sda1 and /dev/sda2

format using mkfs.vfat like this

mkfs.vfat /dev/sda1
mkfs.vfat /dev/sda2


after that you can mount them

mount /dev/sda1 /media/usbdrive1
mount /dev/sda2 /media/usbdrive2

of course if you want to mount it somewhere other then /media/usbdrive then you can i just used that as an example. I hope this answers any questions you have.

Last edited by exvor; 05-06-2008 at 05:31 PM.
 
  


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
Problem with usb pendrive and usb modem ZTE ZXDSL 852 AM33N Linux - Hardware 3 12-10-2008 04:25 AM
usb pendrive in dell inspiron with 8 usb ports sergioricardo Linux - Hardware 4 02-12-2008 12:05 PM
Conflicting USB mouse & usb pendrive on Slackware 11.0 aruntom55 Slackware 3 08-26-2007 02:34 AM
usb pendrive, again. dve Linux - Hardware 15 12-12-2006 04:58 AM
usb pendrive carmelo Slackware 3 04-08-2006 11:09 AM

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

All times are GMT -5. The time now is 09:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration