HOWTO Recover Files from a Non-Bootable Windows PC using Ubuntu Live

Update: fixed typos in steps 3 & 8.

My preaching the joys of Mac to all my coworkers has claimed another victim; John, who I share my office with, purchase a shiny new 20″ iMac G5 two days ago. John asked me for a way to get some files off his old Windows PC without booting Windows, because his Windows install is very flaky, and doesn’t like to boot anymore. I developed the following procedure using a Ubuntu Live CD.

This wasn’t as easy as I’d expected. Ubuntu Live is great, but it’s not designed for system recovery. I had 2 yr old copy of Knoppix in the office, but I couldn’t get everything working, so I tried a brand new Ubuntu Live CD. With a little work I got things going.

The Premise: Boot a Windows PC using a Ubuntu Live CD. Mount the Windows drive and share it using Windows File Sharing (aka Samba). I chose to share with Samba because just about everything can be a client. Windows, Mac OS X, and most Unixen/Linuxen can retrieve files from Samba shares.

The Requirements: Ubuntu Live CD, network connection between the unbootable machine and the machine that will recover the files, and a live internet connection (proxied is ok). The internet connection is required because the Live CD is missing a key piece of software, which we can get with a net connection. Other LiveCDs may not have this restriction (a recent Knoppix, perhaps, but that’s another HOWTO). Note that if your recovery system is a Mac, you don’t even need a router/switch to connect the machines… the Mac’s ethernet port is auto-sensing, and will reverse directions if connected to a PC’s ethernet card with a standard RJ-45 cable. Sweet.

The Steps:

  1. Boot from a Ubuntu Live CD. This method was tested with Ubuntu 5.10 “Breezy Badger”. It should work with Ubuntu 5.4, “Hoary Hedgehog” as well, although I have not (yet) tested this.

  2. Open a Terminal window. From the menus at the top of the screen, choose Applications | Accessories | Terminal.

    Terminal Window Screenshot

  3. Now we need to create a mount point for the Windows drive. We’ll use the traditional location of /mnt.

    cd /mnt
    sudo mkdir windrive
    
  4. Run the Ubuntu Disks Manager. From the system menu bar, choose System | Administration | Disks. In the Disks Manager, find the Hard Disk icon that represents your Windows drive. It is usually /dev/hda. You may see other Hard Disks that you don’t recognize, these are virtual devices created by the LiveCD.

    Disks Manager Disk List Screenshot

  5. On the partitions tab, locate your Windows partition. For many systems, there will be only one partition to choose. The Partition Type should be (something like) NTFS, FAT, or FAT32. In the Access Path text box, enter /mnt/windrive. Make a note of the “Device” value. In the example below (and on many machines), its /dev/hda1. Click Enable.

    Disks Manager Partition List Screenshot

  6. Return to the terminal window. Type mount and press enter. In the output generated, look for the device name from the last step, and note the value after the word “type”. Pay special attention to spelling, case, etc. In the example below, our device /dev/hda1 has a type of ntfs.

    Checking Partition Type Screenshot

  7. Although the windows drive is now mounted, we can’t use it yet to share, because it’s only accessible to the root user, due to the default mount behavior for Windows drives. We need to remount the drive ourselves and override this. First, return to the Disks Manager, and Click Disable. Close Disks Manager.

  8. In the terminal window again, mount the drive manually. Be sure to substitute your device name if it’s not /dev/hda1, and to substitue your filesystem type, if it’s not ntfs. The ls command should show you the contents of your Windows drive.

    sudo mount -t ntfs /dev/hda1 /mnt/windrive -o "umask=022"
    ls windrive
    
  9. So far, so good- we can read the contents of the Windows drive as the default user (named, oddly enough, ubuntu). Now we have to enable Windows File Sharing, aka Samba. The bad news is, the LiveCD doesn’t include the smbd, the Samba Daemon. The good news is, you can install it automatically, and in memory (since we’re running from CD). If you access the web via a proxy server, step 10 is for you. If not, skip ahead to step 11.

  10. (Proxy users only) We need to tell Ubuntu’s package system how to use your proxy to access the Internets. From the system menu bar, choose System | Administration | Synaptic Package Manager. From Synaptic’s menu bar, choose Settings | Preferences. On the Network tab, enter your proxy settings. Click OK, and quit Synaptic.

    Synaptic Network Preferences Screenshot

  11. From the system menu bar, choose System | Administration | Shared Folders. The Shared Folders app will start, and warn you that no sharing services are installed. Check the box for Samba, and click Apply. An installation progress dialog will appear; when the installation is complete, you will see the message “Changes Applied”. Close the dialog.

    Sharing Services Dialog Screenshot

    Installation Dialog - Changes Applied Screenshot

  12. In the Sharing window, choose Add. In the Share Folder dialog that appears, change the path to /mnt/windrive. Set the name to Windrive, and check the “Allow browsing folder” box. Click ok.

    Share Folder Dialog Screenshot

  13. We’ve told the system to share the Windows drive via Windows File Sharing, but Samba will prompt for a user name and password that don’t exist. Let’s fix that. Return to the terminal window, and run a couple of commands. After the first command, you’ll be asked for a new SMB password. This is the password you’ll use from another computer to access the share. Use something you’ll remember, this is just a temporary hack. I used ‘test’.

    sudo smbpasswd -a ubuntu
    sudo sh -c "echo 'ubuntu=\"ubuntu\"' > /etc/samba/smbusers"
    

    Samba credentials commands Screenshot

  14. We’re ready to test. The easiest way to connect to your machine is using the IP address. You can check your IP with the ifconfig command. Look for a line that begins “inet addr”.

    ifconfig Screenshot

  15. Test it! From Windows, you can use Start | Run… and enter “\172.17.25.46\windrive” (change the IP, of course). When prompted for credentials, user name is “ubuntu”, password is “test” (or whatever you used in step 13).

    Windows Run Dialog Screenshot

    Success

You can now access the files on the Windows drive of the PC running Ubunutu Live. I’ll try to get a Mac OS X screen shot up later.

Both comments and pings are currently closed.

50 Responses to “HOWTO Recover Files from a Non-Bootable Windows PC using Ubuntu Live”

  1. [Geeks Are Sexy] Says:

    Other solutions.<br/>

    You could also use Knoppix, or mount your HD as a secondary IDE disk on a working windows PC and use PCinspector as seen here:

    Hard drive recovery utilities: when you can’t afford to lose that data: http://geeksaresexy.blogspot.com/2005/12/hard-drive-recovery-utilities-when-you.html

  2. [Geeks Are Sexy] Says:

    Other solutions.<br/>

    You could also use Knoppix, or mount your HD as a secondary IDE disk on a working windows PC and use PCinspector as seen here:

    Hard drive recovery utilities: when you can’t afford to lose that data: http://geeksaresexy.blogspot.com/2005/12/hard-drive-recovery-utilities-when-you.html

  3. Martin Says:

    Try Kanotix<br/>

    Hi. Using a Kanotix Live CD would have made some of this easier for you. When I boot the latest Kanotix live CD, all the haed drive partitions on my system visible on the desktop, and can be mounted. I have used a Kanotix live CD to recover data before. If the machine had a CD-RW drive, just write the data to however many CDs you need with K3B. (CD-R media is cheaper than Diskettes these days). Or you could write the data to a USB flash drive if it will fit. I tried Ububtu (and Kubuntu). Too many restrictions (such as no root user created during install…there are some things you need to use a root password for, and a few that you need the ability to log in as root to do) and Ubuntu has strayed too far from Debian SID for me.

  4. Peppery Says:

    Thanks a million! :)

  5. AskMe Says:

    How can I write to NTFS partition, without using Samba share<br/>

    I have Windows with NTFS partition, when I booted my computer with Knoppix 4.0 I can see the file and folder but I cannot write or delete. Please let me know how to do it without using Samba share!!!

  6. Bryan C Says:

    You saved the friggin day. THank you for the very easy to follow instructions. I saved all my gf’s pictures and music when I had to wipe out the drive due to problems.

  7. Colin Ashley Says:

    Thanks for your tutorial. Samba was more confusing than I had anticipated. Now at least I can perform a rescue without having to learn this stuff inside out and upside down.

  8. Oortcloud Says:

    THANKS!<br/>

    This saved my personal data from a crashed laptop! Thank you!

  9. Andrew Says:

    Dude!<br/>

    Great article – I’d gone half the way through by myself but was stumbling over the samba config.

    A quick google and your article told me exactly what I needed to know.

    Nice one!

  10. greg Says:

    Is there any reason umask=0 can’t be applied to an NTFS partition?

  11. Jason Says:

    umask<br/>

    Greg-

    You’re correct, there’s no reason (that I can think of) that you couldn’t set the umask wide open for this use. I tend to think of 022 as a ‘default’ umask, so I just used that. However, the umask must be specified in octal; while 0 is a valid octal value, I don’t know if if would work with mount, or if you must specify 000. Unfotunately, I don’t have an NTFS partition handy to test with at the moment.

  12. Mike S Says:

    Excellent<br/>

    Excellent article. I’ve referred other people at work to this web page and I have used the article myself to good effect.

    Thanks

  13. Mike D. Says:

    Dude. Sweet.<br/>

    Thanks, man. Excellent walkthrough. Saved me loads of time and lost data.

  14. Stacy Brodzik Says:

    I’m trying to back off the files from a non-bootable windows ntfs drive to a usb ntfs drive attached to the same machine. Using Ubuntu, I can see both drives and browse through them, but I can’t get past the root permissions problem. I don’t have the laptop connected to a network, but since I’d just like to copy from internal to external drive, I didn’t think I needed a network. Please advise.

  15. matt burnham Says:

    ntfs under ubunutu<br/>

    As far as I know, Ubuntu cannot write to NTFS in a stable manner as of yet. for this reason, they havent’ included any unfinished ntfs writing tools. I’ve been running a dual boot ubuntu/xp box, and I use a second hard drive formatted in fat- since both xp and ubuntu can read/write to that for things I need to access on both.

  16. zyje Says:

    yes thanks for this work

  17. David Goulden Says:

    You are a complete star. This tutorial saved an inordinate amount of work. Thanks.

  18. Roger Cornwell Says:

    My thanks too: very easy instructions to follow, and it has rescued 11Gb of data from a non-booting Windows PC. Just one comment: at step 15, the command to enter is given as “\172.17.25.46\windrive” and I think it should start with \ (as the screen grab below it shows). Certainlyu i had to make that adjustment to get it to work.

  19. Matt Says:

    Great walkthrough!

    many many thanks.

  20. Kaedrin Weblog Says:

    The Death of Sulaco…

    I have two computers running here at Kaedrin headquarters. My primary computer is a Windows box called Sulaco. My secondary……

  21. Fredrik Karlsson Says:

    Amazing guide! Now I only have one disc I never leave home without. Thanks and keep up the good work!

  22. How To Access Your Windows Hard Drive From Ubuntu « Technical Itch Says:

    [...] Whilst helping one of my readers install Ubuntu I came across a link on how to access information on a Windows hard drive from Ubuntu. The link is specifically for people whose Windows installation has crashed and need to recover information via Ubuntu, but is equally useful for people who have a working Windows installation and need to share data between Ubuntu and Windows. [...]

  23. Ed Says:

    Thanks for this information. With the newer Ubuntu 6.1 live CD, I needed to get samba installed via, ‘sudo apt-get install samba smbfs’. From there, I did a simple ‘sudo mount -t vfat /dev/hda1 /mnt/windrive -o “umask=022″‘.

    Thank you for your information on your previous Ubuntu Live saves.. it’s saved my sanity.

  24. myself Says:

    ntfs-3g will mount your drive directly in ubuntu with read-write access. It’s still in beta, but it’s pretty stable; I haven’t had any issues with it. http://ubuntuforums.org/showthread.php?t=217009

  25. Ray Says:

    nice little article — i tried using livecd 6.06 but when it came to auto installing the smb pkgs it complained for me.

    to get around this, i got a copy of a wuftpd, built it on a working linux box and got it onto the livecd box — mounted the relvant partitions and then “sudo password ubuntu” so i knew the password and then started the ftpd server “sudo /tmp/wuftpd/sbin/in.ftpd -a -l -s -p 21″

    from another box i was able to retrieve my data. used both ftp client and also wget to get to the livecd box

    configured wu-ftpd using:

    CFLAGS=”-s -Os” LDFLAGS=”-static” ./configure –prefix=/tmp/wuftpd –disable-pam –enable-password –with-etc-dir=/tmp/wuftpd –disable-rfc931 –disable-dns

  26. Eiger Says:

    I have a problem i think at step 12. Windrive does not show up as an option. If i go to the Computer File Browser and click on new volume, it gives the following error error: device /dev/hde5 is not removable

    error: could not execute pmount

    I was able to get the Samba share working for the Ubuntu system and linked to another computer. My goal is to pull a few folders to another computer or CD-RW.

    Thanks. You are a life saver. These directions rock.

  27. ScriptingLife » Ubuntu To The Rescue Says:

    [...] http://jclark.org/weblog/Miscellany/Tech/ubrescue.html [...]

  28. Jonathan Keim Says:

    Thanks man!

  29. John Says:

    Thanks so much for this tutorial, it was very helpful and easy to follow. Thanks again!!

  30. charles Says:

    Your tutorial was awesome- easy to follow, well written and the screen shots also helped out a lot. Now, I’m running Edgy Eft 6.10. and it does not include Disk Manager anymore. I searched and people recommended Pysdm. I installed it running the Synaptic Package Manager, clicking Repositories at top, and checking the first box- “Community Maintained Open Source (Universe)”. Then the Storage Device Manager shows in my program list. I found the windows drive, unmounted it, then clicked the “Open folder” icon to its’ left and entered /mnt/windrive and chose “open”. I then went ahead with your directions to mount the drive. Jason, I’ve emailed you screenshots.

  31. mark Says:

    someone please help me i get to step 12 and windrive isnt an option what do i do

  32. Jacob Says:

    First off thanks for this great write up its helped me once recovering files already.

    I am wondering if I could hook up a scocondary drive out of a Windows box as a secondary drive in my redhat linux machine using this without losing any info on the drive. The way it looks it should work, I just needed some reassurance.I can afford to lose the info on the drive.

  33. Sergio Says:

    Just a quick note on the lack of Disk Mananger in Edgy Eft. I used GParted in its place and it worked great for me. Great tutorial.

  34. Joe K Says:

    Thank you so much! You saved my life and my would-be children! haha, it worked great. Flawless instructions

  35. Ed Says:

    Solid gold walkthrough. I managed to recover emails from a failed WinXP repartitioning effort which I though were lost forever!

    I used 6.0.6 Dapper Drake and encountered only two hiccups (quickly resolved):

    1. The Samba install whilst enabling ‘Shared Folders’ – it was looking for ‘samba3.0.22-lubuntu3.1i386.deb’ but it seems the package has been upgraded to ‘samba3.0.22-lubuntu3.2i386.deb’.

    2. Browsing the ‘\XXX.XXX.XXX.XXX\Windrive’ share from the Windows machine failed initially, I found I had to go back to the ‘Shared Folders’ admin tool and re-add the ‘/mnt/windrive’ directory after the step where you change the Samba password.

    Many thanks!

  36. Technical Itch » Blog Archive » How To Access Your Windows Hard Drive From Ubuntu Says:

    [...] Whilst helping one of my readers install Ubuntu I came across a link on how to access information on a Windows hard drive from Ubuntu. The link is specifically for people whose Windows installation has crashed and need to recover information via Ubuntu, but is equally useful for people who have a working Windows installation and need to share data between Ubuntu and Windows. [...]

  37. richard Says:

    Thank you for the comprehensive walk through!

  38. Ron Carey Says:

    Great Instructions! thanks. Saved my data (except for email which is gone for some reason)!

    Many thanks

  39. Doc Says:

    As above, aside from the lack of disk manager in 6.16 (though you can also find it using fdisk -l) a great guide. You’ve helped me save my friend’s dissertation :)

  40. dave Says:

    sudo mount -t ntfs /dev/hda1 /mnt/windrive -o “umask=022″ ls windrive

    great advice, why didnt i think of it before, and so easy!

    thanks so much!

  41. dave Says:

    one more thing, if u use knoppix or kubuntu 6.10 (which i am using), usb drives are auto loaded, so forget about samba, i just plugged in my ipod and recovered EVERYTHING from my non-booting windows partition.

    cheers!

  42. Pradeep Says:

    Thanks for saving a couple of days work!

  43. confused Says:

    “network connection between the unbootable machine and the machine that will recover the files”? i’m confused. what does that mean? how do you connect the two computers? when you are in ubuntu why can’t you save your windows files to a flash drive

  44. Jason Says:

    Confused –

    These directions require a network connection between the unbootable machine, and a second machine. The original scenario for which I developed this process was to recover many files from a non-bootable PC (including a large MP3 collection, IIRC), far more than would fit on the average thumb drive.

    If you have a wired or wireless router used to share an internet connection between multiple computers, connecting both machines to the router will provide the needed network connection. If your recovery system is a Mac running OS X, you can just connect the two machines directly with an Ethernet cable- modern Macs have an auto-sensing Ethernet port that doesn’t require a router for a direct connection.

    The idea of using a flash drive is a good one, if the volume of files isn’t too great. A USB external HD is also a possibility. I haven’t tried either option, so I can’t offer directions. However, these instructions are a good 18 months old now, and 3 Ubuntu revisions old as well. One of these days I intend to provide an updated version of this recovery guide; maybe I’ll I try that option as well.

  45. Access Windows Files booted from Kubuntu Disc (help meeeeeee!) - Linux Forums Says:

    [...] jclark.org – HOWTO Recover Files from a Non-Bootable Windows PC using Ubuntu Live This seems like a good one, but right off the bat it doesn’t work. "Run the Ubuntu Disks Manager. From the system menu bar, choose System | Administration | Disks. In the Disks Manager, find the Hard Disk icon that represents your Windows drive. It is usually /dev/hda. You may see other Hard Disks that you don’t recognize, these are virtual devices created by the LiveCD." I don’t have a system menu bar and can’t find this? Am I running a different system than this guy? How do I check what system I am running? thanks! [...]

  46. manivalde Says:

    At step 3. I get ubuntu@ubuntu:~$ cd /mnt ubuntu@ubuntu:/mnt$ sudo mkdir windrive mkdir: cannot create directory `windrive’: File exists

    In the disk manager the filesystem name is Unformatted

    At step 6. it is unionfs on / type unionfs (rw) proc on /proc type proc (rw) /sys on /sys type sysfs (rw) varrun on /var/run type tmpfs (rw) varlock on /var/lock type tmpfs (rw) procbususb on /proc/bus/usb type usbfs (rw) udev on /dev type tmpfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) devshm on /dev/shm type tmpfs (rw) lrm on /lib/modules/2.6.15-23-386/volatile type tmpfs (rw) tmpfs on /tmp type tmpfs (rw,nosuid,nodev)

    At step 7. Theres no Disable option, it is still Enable becouse it didnt turn to Disable after step 5.

    At step 8. it is ubuntu@ubuntu:/mnt$ ls windrivesudo mount -t tmpfs /dev/hda1 /mnt/windrive -o “u mask=022″ ls: windrivesudo: No such file or directory ls: mount: No such file or directory ls: tmpfs: No such file or directory ls: umask=022: No such file or directory brw-rw—- 1 root 3, 1 2008-08-19 12:49 /dev/hda1

    At step 12. There isnt to Windrive to select for path.

    So Im stucked. also when I try to boot from first harddisk it says cant load operating system Thanks.

  47. Carlos P Says:

    Hi Everyone, I am not going beyond step 4.

    Run the Ubuntu Disks Manager. From the system menu bar, choose System | Administration | Disks. In the Disks Manager, find the Hard Disk icon that represents your Windows drive. It is usually /dev/hda.

    When I click on ‘System’ then ‘Administration’ I don’t get ‘Disks’ as a choice. The version of Ubnutu I have is 8.10. How should I proceed? Thanks.

  48. Brian W Says:

    Ubuntu live CD version 11 will do this very easily if you just put an image of Ubuntu on to a CD and run it from there. It will show you all the files on your Windows hard drive you just take them off of there and put them wherever you need them.

  49. Bart Rossnagel Says:

    Thanks for the Simple, Detailed steps provided.I worked exactly as per the instructions but, my Host made a Magic and Added its own Prefix_Username….

  50. Phil Says:

    I’ve used Knoppix for years to recover files from bad harddrives. My knoppix flavor of choice is 5.3.1 because it is ~5 clicks and I have samba running on the dead machine to start pulling files from.

    I like this approach because there’s no thought process involved. Put the DVD in, start the server, plug in the password, figure out the IP and you’re done. I don’t know why, but newer versions of Knoppix have completely killed this simplistic method for enabling samba. I’m not a linux nut and I don’t have time to remember all of the commands needed to enable and configure a samba server for something I need maybe twice a year.

    Ever since the newer releases of samba and lack of hardware support with 5.3.1 catching up with me, I’ve wished for quite some time that someone would create a live cd linux distro of nothing but a simple GUI and a simple way to start the samba server. If I knew more about linux, I would head up the project myself but since I suck at linux, I’m left to older annoying methods like taking the HD out of a laptop and hooking it up to an older computer that knoppix understands.

    Just read comment #48… Gonna try it out and see for myself :)