LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 01-03-2007, 12:20 PM   #1
slimjim
Member
 
Registered: Apr 2004
Location: east midlands, england
Distribution: Ubuntu 9.04
Posts: 56

Rep: Reputation: 15
usb flash drive / ext2 oddness


Hiya,

I bought a 1GB USB flash stick the other week, and today I decided to put an ext2 filesystem on it, to make it a shade more Linux-friendly (and because I like to tinker).

So I did the necessary from fdisk, and ended up with this:


Code:
Disk /dev/sdf: 1030 MB, 1030225920 bytes
32 heads, 62 sectors/track, 1014 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1        1014     1005857   83  Linux
All well and good. So I ran mke2fs:

Code:
sauce:/home/jg# mke2fs /dev/sdf1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125952 inodes, 251464 blocks
12573 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
15744 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
sauce:/home/jg#
Kushti! At this point, I can mount the usb stick with no problem:

Code:
sauce:/mnt/pinkstick# df -m .
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sdf1                  967         2       917   1% /mnt/pinkstick
Yes, it's pink. Harder to misplace

The trouble is, if I then unmount and (sorry about this, I was brought up on Benny Hill and Carry On films) reinsert my pink stick ..

Code:
sauce:~# umount /mnt/pinkstick/
sauce:~# ls -l /dev/sdf1
brw-rw---- 1 root disk 8, 81 Jan  3 17:06 /dev/sdf1
sauce:~# # stick physically removed and reinserted at this point
sauce:~# ls -l /dev/sdf1
ls: /dev/sdf1: No such file or directory
sauce:~#
.. I appear to lose the partition. Interestingly, I can still see it from fdisk, but it's gone from the device tree, and obviously I can't mount it, read from it or write to it.

Code:
sauce:~# fdisk /dev/sdf

Command (m for help): p

Disk /dev/sdf: 1030 MB, 1030225920 bytes
32 heads, 62 sectors/track, 1014 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1        1014     1005857   83  Linux

Command (m for help): q

sauce:~# ls -l /dev/sdf1
ls: /dev/sdf1: No such file or directory
sauce:~# ]
.. any thoughts?

Cheers
Slim
 
Old 01-03-2007, 12:28 PM   #2
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 56
And why do you think you can read a partition that is not mounted???

You have a mountpoint for the partition use it;

mount -t ext2 /dev/sdf1

ls -l /mnt/pinkstick
 
Old 01-03-2007, 01:10 PM   #3
slimjim
Member
 
Registered: Apr 2004
Location: east midlands, england
Distribution: Ubuntu 9.04
Posts: 56

Original Poster
Rep: Reputation: 15
I don't think that.

The problem, as I stated, is that it's not possible to mount it:

Code:
sauce:/home/jg#  mount /mnt/pinkstick/
mount: special device /dev/sdf1 does not exist
sauce:/home/jg# grep pink /etc/fstab
/dev/sdf1 /mnt/pinkstick ext2 user,noauto 0 0
sauce:/home/jg#

Last edited by slimjim; 01-03-2007 at 01:11 PM.
 
Old 01-03-2007, 06:20 PM   #4
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 56
OK, then as a suggestion remove the device wait a bit then insert the device and check the messages;

tail /var/log/messages or tail dmesg

Maybe the device is no longer known as /dev/sdf
 
  


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
Using a usb thumb drive or flash drive as a swap partition. stevenjoseph Linux - Hardware 8 01-16-2012 01:09 PM
USB Pen Drive / Flash Drive Unmounted but the power is there teluguswan Linux - Hardware 11 10-04-2008 04:36 PM
USB flash drive (Pen drive) mounts read only prabhatsoni Linux - Hardware 24 07-02-2007 02:28 PM
extlinux to boot ext2 USB flash Weavind Linux - Software 1 04-06-2006 05:33 AM
Non-root write access to a USB drive (ext2) ?? jmborr Linux - Hardware 4 10-17-2005 03:38 PM


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