LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to clone a USB Drive ? (https://www.linuxquestions.org/questions/linux-software-2/how-to-clone-a-usb-drive-4175576604/)

bloozman23 04-03-2016 11:52 PM

How to clone a USB Drive ?
 
The Exact Situation
"X" gave a Pendrive and it contains data and X wants data recovered.
According to "X" pendrive was last used on a Windows Machine probably
infected by virus.



To be on the safer side I want to clone the USB Drive, How
Can i Do it? dd command?


Ubuntu 14.04 LTS Disktools
drive shown as /dev/sdd
But I cannot access the drive.

bloozman23 04-04-2016 02:02 AM

Additional
info

fdisk -l returns

Disk /dev/sdb: 2000 MB, 2000682496 bytes
62 heads, 62 sectors/track, 1016 cylinders, total 3907583 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

syg00 04-04-2016 03:11 AM

Yes, dd will give you an image to work on. What do you mean you can't access the drive - if that were the case, fdisk wouldn't return anything.
So /dev/sdd is now /dev/sdb ?.

Windows will not allow a device with an id of 0x0 - and no partition table might suggest it has been zeroed out. Testdisk would be the place to start.

bloozman23 04-04-2016 04:52 AM

Quote:

Originally Posted by syg00 (Post 5525903)
Yes, dd will give you an image to work on. What do you mean you can't access the drive - if that were the case, fdisk wouldn't return anything.
So /dev/sdd is now /dev/sdb ?.

Windows will not allow a device with an id of 0x0 - and no partition table might suggest it has been zeroed out. Testdisk would be the place to start.

Actually between the post I switched to another Ubuntu linux installation, drive became ==> sdb

erik2282 04-04-2016 10:59 AM

Somebody gave you a flash drive and they want the files recovered. Meaning he is unable to get files him/herself and they want you to do it, right? Am I missing something? Why would you want to clone the drive?

CGIMan 04-04-2016 03:45 PM

If OP suspects the usb drive is infected, cloning it will include the virus as well. Before cloning the drive, I would first mount the USB stick and run clamav to check for viruses. If clamav removes or reports no infected files, then OP can umount the drive and then do a dd of it.

bloozman23 04-05-2016 01:13 AM

Quote:

Originally Posted by erik2282 (Post 5526049)
Somebody gave you a flash drive and they want the files recovered. Meaning he is unable to get files him/herself and they want you to do it, right? Am I missing something? Why would you want to clone the drive?

Rationale for Cloning
1.To Try tools Recovery tools like Test Disk,

Analysed the Drive
Photorec and testdisk
unable to recover anything.:(

jefro 04-05-2016 06:54 PM

I'd use testdisk to get the files off. Scan the files with an av scanner then nuke the usb with a new partiton.

All those files could potentially be infected.

bloozman23 04-06-2016 05:49 AM

Quote:

Originally Posted by jefro (Post 5526781)
I'd use testdisk to get the files off. Scan the files with an av scanner then nuke the usb with a new partiton.

All those files could potentially be infected.

After Running TestDisk

Code:

Disk recimage.img - 2000 MB / 1907 MiB - CHS 244 255 63
Current partition structure:
    Partition                  Start        End    Size in sectors


Partition sector doesn't have the endmark 0xAA55


Code:

Disk recimage.img - 2000 MB / 1907 MiB - CHS 244 255 63

    Partition                  Start        End    Size in sectors


No partition found or selected for recovery

Going for a Deep Search
Code:

Disk recimage.img - 2000 MB / 1907 MiB - CHS 244 255 63

    Partition                  Start        End    Size in sectors


No partition found or selected for recovery

Stuck!
What do you think,

1. This Media is Corrupt and Recovery impossible aka you can throw it away,:(
2. This Media is Corrupt and Partial Recovery ?
3. This Media is Corrupt and Can recover Most of the Files
4. May be Few Files could be recovered?

syg00 04-06-2016 06:30 AM

Quote:

Originally Posted by myself (Post 5525903)
Windows will not allow a device with an id of 0x0 - and no partition table might suggest it has been zeroed out.

If testdisk and photorec don't find partition(s)/file(s), they are likely gone for good.

I would bet the media is ok - just needs (re-)formatting. Which of course will make sure the data is toast.

bloozman23 04-06-2016 07:45 AM

Quote:

Originally Posted by syg00 (Post 5526977)
If testdisk and photorec don't find partition(s)/file(s), they are likely gone for good.

I would bet the media is ok - just needs (re-)formatting. Which of course will make sure the data is toast.

Reformatted,

Code:

Disk /dev/sdb: 2000 MB, 2000682496 bytes
62 heads, 62 sectors/track, 1016 cylinders, total 3907583 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

Disk identifier: 0x00000000 Why is it all zero ? something wrong

jefro 04-06-2016 03:16 PM

See what gparted says about it. Might have to make a new(correct) partition ??

Markx7 04-06-2016 03:20 PM

You said X gave you this stick. I think X did something wrong and the usb got corrupted (i.e accidentally removed the usb stick while copying files or repeatedly removing the usb without first safely ejecting it) or the virus from X's computer did something to the usb stick's partition table.

Ask your friend X what really happened? Also, tell your friend X there was no partition table on the stick so s/he wil not blame you.

Markx7 04-06-2016 04:35 PM

Your friend X may want to use this windows tool to restore the partition
http://www.yodot.com/hard-drive-reco...usb-drive.html

michaelk 04-06-2016 06:03 PM

Quote:

Disk identifier: 0x00000000 Why is it all zero ? something wrong
Probably not.

I do not think creating a new partition table generates a new disk identifier. It is just a random number created when building a new MBR. Odd but it might of always been zero from the start. If you can successfully read / write from the drive then it is probably ok. Take a look at the output of the dmesg command. If you see any read / write errors pertaining to the flash drive then it is might be going bad.

My first guess was the drive was bad and expected the format to fail...


All times are GMT -5. The time now is 01:56 AM.