Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Copying from drive to drive in Alt Linux testdisk.

  1. Dec 10, 2015 #1

    DaveC426913

    User Avatar
    Gold Member

    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?
     
  2. jcsd
  3. Dec 10, 2015 #2

    ElijahRockers

    User Avatar
    Gold Member

    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?
     
  4. Dec 10, 2015 #3

    DaveC426913

    User Avatar
    Gold Member

    I'll try.
     
  5. Dec 10, 2015 #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
     
  6. Dec 10, 2015 #5

    DaveC426913

    User Avatar
    Gold Member

    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: Dec 10, 2015
  7. Dec 10, 2015 #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.
     
  8. Dec 10, 2015 #7

    DaveC426913

    User Avatar
    Gold Member

    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%!

    Will do.
     
  9. Dec 10, 2015 #8

    DaveC426913

    User Avatar
    Gold Member

    Success!!

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

    Thank you!
     
  10. Dec 10, 2015 #9

    DaveC426913

    User Avatar
    Gold Member

    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.
     
  11. Dec 10, 2015 #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
     
  12. Dec 10, 2015 #11

    DaveC426913

    User Avatar
    Gold Member

    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.
     
  13. Dec 10, 2015 #12

    DaveC426913

    User Avatar
    Gold Member

    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.
     
  14. Dec 10, 2015 #13
    try find /mnt/hdlarge -name ".pst"
    Edit: Wait nevermind, you weren't able to mount
     
  15. Dec 10, 2015 #14

    DaveC426913

    User Avatar
    Gold Member

    :)
     
  16. Dec 10, 2015 #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?
     
  17. Dec 10, 2015 #16

    rcgldr

    User Avatar
    Homework Helper

    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?
     
  18. Dec 10, 2015 #17

    DaveC426913

    User Avatar
    Gold Member

    I figured out how to do the copying. It's as subject to bad sectors and corrupt files as any other method.
     
  19. Dec 10, 2015 #18

    DaveC426913

    User Avatar
    Gold Member

    Thanks Routaran. I really appreciate your holding my hand through that.
     
  20. Dec 10, 2015 #19
    Glad I could help :)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Copying from drive to drive in Alt Linux testdisk.
Loading...