Copying A Disk
Shizzle Cash
shizzlecash at gmail.com
Sat Jul 12 01:28:16 UTC 2008
On Jul 11, 2008, at 7:19 PM, Pete Holsberg wrote:
> Where would a USB drive appear?
If you could, please specify exactly what you're trying to
accomplish: What kind of disk are you trying to access? What exact
problem are you having when attempting to access the drive currently?
What errors are you getting (if any) are you getting when trying to
access the drive in Windows?
Without knowing the answer to those questions, here's some general
information for you that might help you access the drive under Linux...
USB devices usually get mounted as scsi devices, so they'll show up
as /dev/sdXY, where X is a letter and Y is a number. For example, on
my linux system, the first available scsi device after my hard drive
(which is /dev/sda) is /dev/sdb. When I insert a USB drive into my
system, it usually comes up as /dev/sdb and the first partition comes
up as /dev/sdb1.
A good way to see what device the system is loading your USB drive as
is to type the following command in a terminal window before inserting
your device:
tail -f /var/log/messages
When you insert your USB disk, you will see some lines of text appear
in the terminal window similar to the following (this is an example
from my system):
Jul 1 14:12:41 usagi kernel: [85370.184792] usb 6-2: new high speed
USB device using ehci_hcd and address 2
Jul 1 14:12:41 usagi kernel: [85370.320777] usb 6-2: configuration #1
chosen from 1 choice
Jul 1 14:12:41 usagi kernel: [85370.591391] usbcore: registered new
interface driver libusual
Jul 1 14:12:41 usagi kernel: [85370.642245] Initializing USB Mass
Storage driver...
Jul 1 14:12:41 usagi kernel: [85370.644691] scsi4 : SCSI emulation
for USB Mass Storage devices
Jul 1 14:12:41 usagi kernel: [85370.646261] usbcore: registered new
interface driver usb-storage
Jul 1 14:12:41 usagi kernel: [85370.646265] USB Mass Storage support
registered.
Jul 1 14:12:46 usagi kernel: [85375.634900] scsi 4:0:0:0: Direct-
Access Memorex Flashdrive 601B PMAP PQ: 0 ANSI: 0 CCS
Jul 1 14:12:47 usagi kernel: [85376.199792] sd 4:0:0:0: [sdb] 1007616
512-byte hardware sectors (516 MB)
Jul 1 14:12:47 usagi kernel: [85376.200539] sd 4:0:0:0: [sdb] Write
Protect is off
Jul 1 14:12:47 usagi kernel: [85376.203281] sd 4:0:0:0: [sdb] 1007616
512-byte hardware sectors (516 MB)
Jul 1 14:12:47 usagi kernel: [85376.204030] sd 4:0:0:0: [sdb] Write
Protect is off
Jul 1 14:12:47 usagi kernel: [85376.204040] sdb: sdb1
Jul 1 14:12:47 usagi kernel: [85376.205105] sd 4:0:0:0: [sdb]
Attached SCSI removable disk
Jul 1 14:12:47 usagi kernel: [85376.205151] sd 4:0:0:0: Attached scsi
generic sg2 type 0
You can ignore most of the information. You're interested in the line
that reads " sdb: sdb1" at the end of it. As you can see, the system
sees my USB disk as device sdb and the partition on it as sdb1. Now,
my system automatically mounts the partition. However, yours may
not. If yours does not, you can see if you can access the drive by
typing the following at a command prompt:
sudo mount -t auto -o ro /dev/<parition> <mount_point>
- The '-t auto' portion of the command tells 'mount' to attempt to
automatically figure out what filesystem the partition is formatted as.
- The '-o ro' portion tells 'mount' to mount the partition as read-
only. This is especially handy if you don't want to accidentally
damage the contents of the partition. You can leave this option off
and it will mount the partition as read-write by default if possible.
- Substitue <partition> for the name of the partition you found in /
var/log/messages. In my case I would replace <partition> with sdb1.
- Substitue <mount_point> with a directory where you would like to
have the partition mounted. A good place would be /mnt or a directory
in /media if one exists, such as /media/disk. So, if I wanted to
mount my USB disk in the directory /mnt my command would look like this:
sudo mount -t auto -o ro /dev/sdb1 /mnt
If 'mount' can't figure out what kind of file system the partition is
formatted as, you may have to tell it specifically. Windows95 - 98
Partitions (as well as USB sticks) are usually formatted as vfat.
If you wish to just make a copy of the contents of the disk, without
mounting it, you can use the following command:
dd if=/dev/<disk> of=<filename>
This will copy the entire contents of the drive to a file, bit for
bit. If you wish to capture just a partition, you can modify the
command to include the partition number after the drive. In my case,
it would look like:
dd if=/dev/sdb1 of=<filename>
To mount the file you created (this will only work if you can
successfully mount the partition before you copy it to a file), you
need to use the following command:
sudo mount -t auto -o loop <filename> <mount_point>
More information about the ubuntu-users
mailing list