Copying from drive to drive in Alt Linux testdisk.

  • #1
DaveC426913
Gold Member
18,975
2,466
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?
 

Answers and Replies

  • #2
ElijahRockers
Gold Member
270
10
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
DaveC426913
Gold Member
18,975
2,466
I'll try.
 
  • #4
447
94
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
DaveC426913
Gold Member
18,975
2,466
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
447
94
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
DaveC426913
Gold Member
18,975
2,466
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%!

there's utilities that do chkdsk type work in linux. Check to see if fsck is part of your liveCD.
Will do.
 
  • #8
DaveC426913
Gold Member
18,975
2,466
Success!!

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

Thank you!
 
  • #9
DaveC426913
Gold Member
18,975
2,466
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
447
94
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
DaveC426913
Gold Member
18,975
2,466
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
DaveC426913
Gold Member
18,975
2,466
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
447
94
try find /mnt/hdlarge -name ".pst"
Edit: Wait nevermind, you weren't able to mount
 
  • #14
DaveC426913
Gold Member
18,975
2,466
try find /mnt/hdlarge -name ".pst"
Edit: Wait nevermind, you weren't able to mount
:)
 
  • #15
447
94
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
rcgldr
Homework Helper
8,715
539
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
DaveC426913
Gold Member
18,975
2,466
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
DaveC426913
Gold Member
18,975
2,466
Thanks Routaran. I really appreciate your holding my hand through that.
 
  • #19
447
94
Glad I could help :)
 

Related Threads on Copying from drive to drive in Alt Linux testdisk.

  • Last Post
Replies
14
Views
6K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
12
Views
4K
Replies
8
Views
1K
  • Last Post
Replies
2
Views
4K
  • Last Post
Replies
12
Views
1K
Replies
4
Views
2K
Replies
7
Views
8K
Replies
6
Views
11K
Top