Copying from drive to drive in Alt Linux testdisk.

In summary, the Windows user tried to copy files to a Linux system, but had a high failure rate. They copied files to two different directories, but the larger partition could not be mounted. They were able to copy files directly from the Windows partition to the Linux system.
  • #1
DaveC426913
Gold Member
22,497
6,168
I am stumped and out of time (got till end of day). I'm trying to recover some files off a crashed Win7 laptop. I'm using a bootable CD with Alt Linux RescueLiveCD and testdisk to copy them to and SD card. I'm new to Linux, so feeling around blindly.

The SD card has been full-formatted on my Win10 system. (I tried formatting it using the Linux, but for some reason, even though I made a new partition, that partition wasn't recognized. ) A friend told me Windows will format it as FAT just fine.

When I run tesdisk, it picks up my HD, my CD and the SD.

I'm at a prompt root@localhost.
fdisk -l
shows me my HD the CD - and the 15G SD card as sdb
ls /dev/sdb
shows me a valid but empty directory, as does ls /dev/sdb1 (If I eject the SD, reboot and look again they're not valid)

So I launch testdisk, find my files of choice, and I copy them to /dev/sdb. Just for fun, I copy them to /dev/sdb1 as well. Both succeed. The program says Success! 1 files copied!

Now I quit out of livetest, back to the prompt.
ls /dev/sdb and ls /dev/sdb1 show me a valid but empty directories, as before. And when I pop the chip into my working lappie, the chip indeed has no files on it.

What am I doing wrong?
 
Computer science news on Phys.org
  • #2
DaveC426913 said:
What am I doing wrong?

Hard to say. Do you have internet access with the live CD? If so, can you copy and paste the terminal output of your attempt to a log file and upload it here?
 
  • #3
I'll try.
 
  • #4
Hey Dave,
You have to mount the disks somewhere on the partition first before you can interact with them to copy files and such.

linux will show you all your devices in your /dev directory. Disks (USB/Harddrives) are showed under sd
/dev/sda is the disk, a is the first disk, b is second, etc.
/dev/sda1 is the partition

you don't interact directly with disks or partitions when you want to manipulate the data stored on them, you have to mount the partition somewhere on your file system.
I suggest you make two directories
Eg:
mkdir /mnt/disk1
mkdir /mnt/disk2

this will create two directories in the /mnt directory
then you mount your source partition at disk1 and destination partition at disk2
(I'll assume /dev/sda1 is where your data is, /dev/sdb1 is your sd card where you want to copy the data to)

mount /dev/sda1 /mnt/disk1
mount /dev/sdb1 /mnt/disk2

Then can copy the files from /mnt/disk1 to /mnt/disk2
Depending on the partition type (NTFS, FAT32, ext) you may have to provide additional flags but usually, mount is smart enough to figure out what if you have the correct packages installed.

You don't want to copy and write directly to the device (like /dev/sdb) because the system will start writing to the start of the drive, meaning it will overwrite partition tables, MBR, etc, basically destroy all the data that currently exists. And since you're copying files and not partition info, you won't be able easily read what you wrote anyway.

Cheers
 
  • Like
Likes ElijahRockers
  • #5
Ah!

There seems to be two partitions on my HD a small one sda1 and a very large one sda2. I assume the large one is my Windows stuff.

So...

mkdir /mnt/sd
mkdir /mnt/hdsmall
mkdir /mnt hdlarge


mount /dev/sdb /mnt/sd
OK

mount /dev/sda2 /mnt/hdlarge or
mount -t ntfs /dev/sda2 /mnt/hdlarge
Failed to read NTFS bitmap
NTFS is either inconsistent or there is a hardware fault or <RAID hardware>
In the first case run chkdsk /f on Windows, then boot twice (which I can't do).

mount -t vfat /dev/sda2 /mnt/hdlarge
wrong fs type

mount /dev/sda1 /mnt/hdsmall
OK

So it seems I am doing the mount correctly, as I was able to mount the smaller partition sd1, but the larger partition sd2 won't mount because it had an I/O error. Linux tried to fix it, but I can't run chkdsk on it in Windows.

Maybe I don't need to mount the HD. I can copy the files directly from /dev/sda2

[EDIT] It's copying but very high failiure rate.
 
Last edited:
  • #6
try using
mount -t ntfs /dev/sda2 /mnt/hdlarge
you may need to install the ntfs-3g package.

there's utilities that do chkdsk type work in linux. Check to see if fsck is part of your liveCD.
 
  • #7
Routaran said:
try using
mount -t ntfs /dev/sda2 /mnt/hdlarge
Tried that, as mentioned above. No joy.

But I am able to copy directly from /dev/sda2 so I'm trying that now.
90% failure rate. But not 100%!

Routaran said:
there's utilities that do chkdsk type work in linux. Check to see if fsck is part of your liveCD.
Will do.
 
  • #8
Success!

Not sure how many files I retrieved successfully, but that's out of my control.

Thank you!
 
  • #9
I tried fsck/dev/sda2. It returns fsdk from util-linux 2.26.2, but provides no exit code. Simply back to prompt. Tried it on /dev/sda1, with same result

fsck /dev/sda returns Bad magic number in superblock.
 
  • #10
can you download Hiren's Boot CD or an ISO of your windows disk?
If you boot into windows from CD, a chkdsk /r should get you around this problem
 
  • #11
OK, next step is to try to retrieve my Outlook .pst file.

It is not in any folders that it is supposed to be.
find -name '*.pst' and it has returned 20 or so files, but all of them are in lib/firmware/ar3k/, and none of them appear to be mail files.
 
  • #12
Routaran said:
can you download Hiren's Boot CD or an ISO of your windows disk?
If you boot into windows from CD, a chkdsk /r should get you around this problem
I have Hiren's. I went in with XP mini, or whatever it is. It was unable to recognize anything on the drive, but I'll run a chkdsk /f and see how that goes.
 
  • #13
try find /mnt/hdlarge -name ".pst"
Edit: Wait nevermind, you weren't able to mount
 
  • #14
Routaran said:
try find /mnt/hdlarge -name ".pst"
Edit: Wait nevermind, you weren't able to mount
:)
 
  • #15
the linux superblock is, IIRC, part of what windows writes to the MBR, definiton of the file type/block size etc.
Can you run a fixmbr from the recovery console using a windows disk?
 
  • #16
Possibly ultimate boot cd (free ware ISO), might have a utility to copy / recover files. I haven't tried it for that, but I was able to replace my systems hard drives by using one of it's clone utilities to copy from old drives to new drives. Do you have another running system, and if so, could you remove the hard drive from the lap top and connect it to the running system and try to recover the files that way?
 
  • #17
rcgldr said:
Possibly ultimate boot cd (free ware ISO), might have a utility to copy / recover files. I haven't tried it for that, but I was able to replace my systems hard drives by using one of it's clone utilities to copy from old drives to new drives. Do you have another running system, and if so, could you remove the hard drive from the lap top and connect it to the running system and try to recover the files that way?
I figured out how to do the copying. It's as subject to bad sectors and corrupt files as any other method.
 
  • #18
Thanks Routaran. I really appreciate your holding my hand through that.
 
  • #19
Glad I could help :)
 

1. How do I copy files from one drive to another in Alt Linux using testdisk?

To copy files from one drive to another in Alt Linux using testdisk, follow the steps below:

  • Open the testdisk program and select the drive containing the files you want to copy.
  • Select "Advanced Filesystem Utilities" and then "Copy" from the menu.
  • Select the files you want to copy by pressing the "c" key on your keyboard.
  • Choose the destination drive and directory where you want to copy the files.
  • Press the "C" key again to confirm the copy operation.

2. Can I copy files between different file systems using testdisk?

Yes, testdisk allows you to copy files between different file systems. However, you may encounter compatibility issues or errors during the copy process, so it is recommended to copy files between drives with the same file system.

3. Is it possible to select specific files or folders to copy using testdisk?

Yes, testdisk allows you to select specific files or folders to copy by using the "c" key to toggle the selection on or off for each file or folder. You can also use the arrow keys to navigate and select files.

4. How long does it take to copy files using testdisk?

The time it takes to copy files using testdisk depends on several factors such as the size and number of files, the speed of the drives, and the overall performance of your computer. In general, testdisk is a fast and efficient tool for copying files between drives.

5. What should I do if the copy process fails or encounters errors?

If the copy process fails or encounters errors, try restarting the testdisk program and attempting the copy again. If the issue persists, it could be due to compatibility issues between the file systems or damaged files. In this case, you may need to use data recovery software to retrieve the files from the drive.

Similar threads

Replies
16
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
936
  • Computing and Technology
2
Replies
35
Views
3K
Replies
14
Views
2K
  • Computing and Technology
Replies
24
Views
7K
  • Computing and Technology
2
Replies
43
Views
3K
Replies
2
Views
5K
  • Programming and Computer Science
Replies
9
Views
2K
  • Computing and Technology
Replies
2
Views
3K
  • Computing and Technology
Replies
1
Views
1K
Back
Top