Pen drive unmount trouble shoot

Asked by Asif ansari

My pen drive gets damaged last night when i was copying file and suddenly my home power supply fused up....when i inserted it later, it is detectable for some time in disk utility and also when i am trying to remount it , it gets automatically ejected ...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Solved by:
Asif ansari
Solved:
Last query:
Last reply:
Revision history for this message
N1ck 7h0m4d4k15 (nicktux) said :
#1

Hi ,

plug-in the USB and open a terminal then write

sudo fdisk -l

and you will see the usb listed as (I assume) : /dev/sdb

then write in terminal

sudo mount /dev/sdb1 /mnt

cd /mnt

ls -a

can you see your files ?

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

Why not just format the device and reinstate the data from backup....

Revision history for this message
Asif ansari (asif-ansari4u) said :
#3

For formatting i need to unmount my device which is basically not happening...

Revision history for this message
Asif ansari (asif-ansari4u) said :
#4

@NikTH

OUTPUT:

asif@asif-desktop:~$ sudo fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbc14bc14

   Device Boot Start End Blocks Id System
/dev/sda1 2046 102397951 51197953 5 Extended
/dev/sda2 * 102398310 200057444 48829567+ 7 HPFS/NTFS/exFAT
/dev/sda3 200057445 297716579 48829567+ 7 HPFS/NTFS/exFAT
/dev/sda4 297717760 301623295 1952768 82 Linux swap / Solaris
/dev/sda5 2048 58593279 29295616 b W95 FAT32
/dev/sda6 58595328 102397951 21901312 83 Linux

Disk /dev/sdb: 8388 MB, 8388608512 bytes
256 heads, 31 sectors/track, 2064 cylinders, total 16384001 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot Start End Blocks Id System
/dev/sdb1 * 63 16382991 8191464+ b W95 FAT32
asif@asif-desktop:~$ sudo mount /dev/sdb /mnt
mount: /dev/sdb already mounted or /mnt busy
asif@asif-desktop:~$ cd /mnt
asif@asif-desktop:/mnt$ ls -a
. ..
asif@asif-desktop:/mnt$

Revision history for this message
N1ck 7h0m4d4k15 (nicktux) said :
#5

On 09/16/2012 10:35 AM, Asif ansari wrote:
> asif@asif-desktop:~$ sudo mount /dev/sdb /mnt
> mount: /dev/sdb already mounted or /mnt busy
> asif@asif-desktop:~$ cd /mnt
> asif@asif-desktop:/mnt$ ls -a
> . ..
> asif@asif-desktop:/mnt$
>
Hi ,

it is

sudo mount /dev/sdb1 /mnt

not /dev/sdb . You can mount only partitions . You forgot the number (1) .

Try again.

Thanks

Revision history for this message
Asif ansari (asif-ansari4u) said :
#6

asif@asif-desktop:~$ sudo fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbc14bc14

   Device Boot Start End Blocks Id System
/dev/sda1 2046 102397951 51197953 5 Extended
/dev/sda2 * 102398310 200057444 48829567+ 7 HPFS/NTFS/exFAT
/dev/sda3 200057445 297716579 48829567+ 7 HPFS/NTFS/exFAT
/dev/sda4 297717760 301623295 1952768 82 Linux swap / Solaris
/dev/sda5 2048 58593279 29295616 b W95 FAT32
/dev/sda6 58595328 102397951 21901312 83 Linux

Disk /dev/sdb: 8388 MB, 8388608512 bytes
256 heads, 31 sectors/track, 2064 cylinders, total 16384001 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot Start End Blocks Id System
/dev/sdb1 * 63 16382991 8191464+ b W95 FAT32
asif@asif-desktop:~$ sudo mount /dev/sdb1 /mnt
asif@asif-desktop:~$ cd /mnt
asif@asif-desktop:/mnt$ ls -a
. ..
asif@asif-desktop:/mnt$

Revision history for this message
N1ck 7h0m4d4k15 (nicktux) said :
#7

On 09/16/2012 10:56 AM, Asif ansari wrote:
> Disk /dev/sdb: 8388 MB, 8388608512 bytes
> 256 heads, 31 sectors/track, 2064 cylinders, total 16384001 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0x00000000
>
>

It has a problem. Can you see the Disk identifier ? 0x00000000

Run in terminal

sudo parted -l

and give the results .

Thanks

Revision history for this message
Asif ansari (asif-ansari4u) said :
#8

The disk was not detected,after the reinsertion
OUTPUT:

asif@asif-desktop:~$ sudo parted -l
Model: ATA ST3160022ACE (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 1048kB 52.4GB 52.4GB extended
 5 1049kB 30.0GB 30.0GB logical ntfs
 6 30.0GB 52.4GB 22.4GB logical ext4
 2 52.4GB 102GB 50.0GB primary ntfs boot
 3 102GB 152GB 50.0GB primary ntfs
 4 152GB 154GB 2000MB primary linux-swap(v1)

Model: Generic Flash Disk (scsi)
Disk /dev/sdb: 8389MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 8388MB 8388MB primary fat32 boot

asif@asif-desktop:~$

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#9

sudo umount /mnt

you can now format the device (This will destroy the data!!) with:

sudo mkfs.vfat /dev/sdb1

You can now mount the blanked partition and start filling it with data.

Revision history for this message
Asif ansari (asif-ansari4u) said :
#10

asif@asif-desktop:~$ sudo umount /mnt
umount: /mnt: not mounted
asif@asif-desktop:~$ sudo mkfs.vfat /dev/sdb1
mkfs.vfat 3.0.12 (29 Oct 2011)
mkfs.vfat: /dev/sdb1 contains a mounted file system.
asif@asif-desktop:~$

In windows it is showing the file system as RAW and free space,used space and capacity is shown as 0 bytes....
In Ubuntu it atleast shows the file system as FAT32 and Disk capacity but get ejected/undetectable after few minutes

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#11

sudo umount /dev/sdb1
sudo mkfs.vfat /dev/sdb1

Should work

Revision history for this message
Asif ansari (asif-ansari4u) said :
#12

Device unmounted successfully
But when in DiskUtility->Format Volume....
After sometime windows error message appear

ERROR CREATING FILESYSTEM

An error occurred while performing an operation on "8.4 GB Unrecognized" (Partition 1 of generic Flash Disk) : The operation failed
>Details
    Error creating file system : helper exited with exit code 1: Error calling fsync(2) on /dev/sdb1 : Input/output error

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#13

You may want to run:

sudo fdisk /dev/sdb

And write a new partition table to the device and then make a new partition on it, could help

Revision history for this message
Asif ansari (asif-ansari4u) said :
#14

I am not getting it, first i have to press w (write table to disk and exit) and then n (add a new partition),Right?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#15

You will need to press O then ENTER to write a new DOS partition table, you may want to then press P to show the partition tabel, if none exist use N to write a new partition and accept defaults. The M option would have shown you all this.

Revision history for this message
Asif ansari (asif-ansari4u) said :
#16

command (m for help): o
Building a new DOS disklabel with disk identifier 0x15eda870.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

command (m for help):

Revision history for this message
Asif ansari (asif-ansari4u) said :
#17

@asif-desktop:~$ sudo fdisk /dev/sdb
[sudo] password for asif:

Command (m for help): o
Building a new DOS disklabel with disk identifier 0xa66283dc.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 8388 MB, 8388608512 bytes
256 heads, 31 sectors/track, 2064 cylinders, total 16384001 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa66283dc

   Device Boot Start End Blocks Id System

Command (m for help): n
Partition type:
   p primary (0 primary, 0 extended,4 free)
   e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-16384000, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-16384000, default 16384000): 16384000

Command (m for help):

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#18

Then press W and it will write to the device, you can now format it

Revision history for this message
Asif ansari (asif-ansari4u) said :
#19

command(m for help): w
The partition table has been altered

Calling ioctl() to re-read partition table

(then the pen drive gets ejected automatically from disk utility,Home->devices,.... )
as soon as it gets ejected Terminal shows

syncing disks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#20

Cool, then run:

sudo mkfs.vfat /dev/sdb1

And it will be good to go :)

Revision history for this message
Asif ansari (asif-ansari4u) said :
#21

As nothing is helping out....i think now i should stop here

i have experienced my 1GB partition with above procedure...
It doesnt take more than 5sec to write partition table.

then whats wrong with it (8GB)?

If you know about any software which can repair my device then plz inform me...

and as my question was about unmounting the disk,which is done i will mark it as SOLVED.Thnx

Thanks alot...

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#22

As a last ditch, grab a strong magnet and hold the device near it for 20 seconds, then turn it over so the other side gets 'cooked' :)

Put the device to one side for half an hour and then plug it into a system, it should be ok.

Revision history for this message
Asif ansari (asif-ansari4u) said :
#23

Thanks, that solved my problem. :D

love u ubuntu

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#24

Yeah thats the last ditch and why you get told to avoid strong magnets :)