Removable media bug

Giuliano Pochini (pochini@denise.shiny.it)
Wed, 28 Apr 1999 21:13:51 MET DST


I insert an empty ext2 disk.

[Giu@localhost Giu]$ mount /mnt/mo

Ok, mounted.

[Giu@localhost Giu]$ dir /mnt/mo
total 27
drwxrwx--- 3 root ShutDown 2048 Apr 23 17:40 .
drwxrwxr-x 8 root ShutDown 1024 Feb 22 17:04 ..
drwxr-xr-x 2 root root 24576 Apr 23 17:11 lost+found
[Giu@localhost Giu]$ echo BlahBlahBlah >/mnt/mo/blah
[Giu@localhost Giu]$ dir /mnt/mo
total 29
drwxrwx--- 3 root ShutDown 2048 Apr 24 10:54 .
drwxrwxr-x 8 root ShutDown 1024 Feb 22 17:04 ..
-rw-rw-r-- 1 Giu Giu 13 Apr 24 10:54 blah
drwxr-xr-x 2 root root 24576 Apr 23 17:11 lost+found
[Giu@localhost Giu]$ umount /mnt/mo

Now I insert another disk containing some files.

[Giu@localhost Giu]$ mount /mnt/mo
[Giu@localhost Giu]$ dir /mnt/mo
total 29
drwxrwx--- 3 root ShutDown 2048 Apr 24 10:54 .
drwxrwxr-x 8 root ShutDown 1024 Feb 22 17:04 ..
-rw-rw-r-- 1 Giu Giu 13 Apr 24 10:54 blah
drwxr-xr-x 2 root root 24576 Apr 23 17:11 lost+found

Aargh! This is the content of the previous disk !!!!

[Giu@localhost Giu]$ echo blah2 >/mnt/mo/bla2
[Giu@localhost Giu]$ dir /mnt/mo
total 148923
drwxrwx--- 3 root root 2048 Apr 24 10:56 .
drwxrwxr-x 8 root root 1024 Feb 22 17:04 ..
-rw-rw-r-- 1 Giu Giu 34334634 Apr 23 17:26 Track_01
-rw-rw-r-- 1 Giu Giu 6 Apr 24 10:56 Track_02
-rw-rw-r-- 1 Giu Giu 44614720 Apr 23 17:28 Track_03
-rw-rw-r-- 1 Giu Giu 40081138 Apr 23 17:29 Track_04
-rw-rw-r-- 1 Giu Giu 39884432 Apr 23 17:30 Track_05
?--------- 0 root root 0 Jan 1 1970 Track_06
?--------- 0 root root 0 Jan 1 1970 Track_07
?--------- 0 root root 0 Jan 1 1970 Track_08
?--------- 0 root root 0 Jan 1 1970 Track_09
?--------- 0 root root 0 Jan 1 1970 Track_10
?--------- 0 root root 0 Jan 1 1970 Track_11
drwxr-xr-x 2 root root 24576 Apr 23 17:11 lost+found

Disaster :-(((
When I unmount the disk, the corrupted directory is written and I lose
all the files :-(

To avoid this beviour I have to try to mount the device without any
inserted disk:

[Giu@localhost Giu]$ umount /mnt/mo

I Eject the disk.

[Giu@localhost Giu]$ mount /mnt/mo
mount: /dev/sdb is not a valid block device

Now the kernel noticed the diskchange, so I reinsert it.

[Giu@localhost Giu]$ mount /mnt/mo
mount: block device /dev/sdb is write-protected, mounting read-only

(yep, I wp it to avoid losing the content (again GRRR!))

[Giu@localhost Giu]$ dir /mnt/mo
total 422857
drwxrwx--- 3 root root 2048 Apr 24 10:56 .
drwxrwxr-x 8 root root 1024 Feb 22 17:04 ..
-rw-rw-r-- 1 Giu Giu 34334634 Apr 23 17:26 Track_01
-rw-rw-r-- 1 Giu Giu 34957262 Apr 24 10:56 Track_02
-rw-rw-r-- 1 Giu Giu 44614720 Apr 23 17:28 Track_03
-rw-rw-r-- 1 Giu Giu 40081138 Apr 23 17:29 Track_04
-rw-rw-r-- 1 Giu Giu 39884432 Apr 23 17:30 Track_05
-rw-rw-r-- 1 Giu Giu 32004758 Apr 23 17:32 Track_06
-rw-rw-r-- 1 Giu Giu 45738284 Apr 23 17:33 Track_07
-rw-rw-r-- 1 Giu Giu 40332748 Apr 23 17:35 Track_08
-rw-rw-r-- 1 Giu Giu 33475630 Apr 23 17:36 Track_09
-rw-rw-r-- 1 Giu Giu 35400294 Apr 23 17:39 Track_10
-rw-rw-r-- 1 Giu Giu 32240598 Apr 23 17:41 Track_11
drwxr-xr-x 2 Giu Giu 24576 Apr 23 17:11 lost+found

Wonderful, isn't it ??
How can I fix it ?

/* LinuxPPC r4
kernel 2.2.6
Fujitsu magneto-optical drive
640MB disk
*/

Bye.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/