slimjim |
01-03-2007 11:20 AM |
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 :D
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
|