Written on: 2020-07-21

Copying files from an NTFS partition over SFTP using SystemRescueCd

A Windows machine has broken. It crashed and now it won't boot. "No boot device available," apparently. It certainly used to be available. I suspect the hard drive has died.

Before I swap out the hard drive for a new one, I would like to recover any data that I can from the old one. So I will put SystemRescueCd on a USB drive and boot from that.

Find the partition

# fsarchiver probe -v

With any luck, the Windows partition of interest will be listed there. If it isn't, then a more serious data recovery approach will be needed.

For the rest of this document, let's assume that /dev/sda2 is the one we want.

Mount the partition

# mkdir /mnt/windows
# ntfs-3g -o ro /dev/sda2 /mnt/windows
# ls /mnt/windows

If it worked, now we need to get the data over the network to another machine.

Find the Wi-Fi network

If you're using a wired connection, skip this wi-fi stuff and go straight to setting an IP address.


# ip a

Look for your wireless interface. On my old ThinkPad, it's wls1.

# iwlist wls1 scan | grep ESSID

Choose an SSID.

Setup WPA

# wpa_passphrase ssid password >/etc/wpa.conf

Where ssid and password are the SSID you chose earlier and the WPA password for that network.

Now, which wireless driver will we use?

# wpa_supplicant

Look for a section in the output (after the usage message) that begins with drivers:

Pick a driver from the list. If you pick the wrong one, you will fail to connect to the wireless network. If that happens, pick a different one and try again.

# wpa_supplicant -iwls1 -c/etc/wpa.conf -Dnl80211

Where wls1 is the interface, /etc/wpa.conf is the file in which you stored the output of wpa_passphrase, and nl80211 is the driver you chose.

If it works, you'll see something like this:


Kill it with ctrl-c and add the -B option to run it in the background:

# wpa_supplicant -B -iwls1 -c/etc/wpa.conf -Dnl80211

Set an IP address

Use DHCP if it's available:

# dhcp wls1

Or something like this, if you want to assign a static address:

# ip a add dev wls1

Check that it worked (and see which address you got, if you used DHCP):

# ip a

Set a password

The root account doesn't have a password on SystemRescueCd. We'll need one to log in via SSH so set one now:

# passwd

Allow incoming SSH connections

# iptables -I INPUT -p tcp --dport 22 -j ACCEPT

SFTP from another machine

Finally, from another machine, you can now connect over SFTP to the IP address that you set above and copy files from the Windows partition:

$ sftp [email protected]
sftp> ls /mnt/windows