Link to home
Create AccountLog in
Avatar of oxygen_728
oxygen_728

asked on

Linux - Restoring Backup with DD & Netcat - Can't write to /dev/sda device

Disclaimer: /dev/sda is not mounted (It wasn't mounted when I backed it up, and it isn't mounted now that I'm trying to restore the backup)

Hi, i made a backup of my hard drive a month ago with:

dd if=/dev/sda | nc IP PORT

Now, I need to restore my backup, so I'm doing:

nc -l -p 1234 | dd of=/dev/sda

My sender computer is sending, but the receiver isn't doing much of any receiving... It appears that roughly 16 megs are being sent, but none received - In fact, when I hit Ctrl-C, i get the message:

write(stdout): Interrupted System Call

and then my terminal is locked up.

I've attempted to run Ubuntu 7 Live CD & Trinity Rescue CD Build 318 -- both operating systems encounter the exact same problem.

It's possible that my hard drive is broken, but I think it's fine

Any tips on writing directly to /dev/sda without mounting?

Thanks
Avatar of dualarrow
dualarrow
Flag of Australia image

Hi

The nc man pages state

 -p source_port
             Specifies the source port nc should use, subject to privilege
             restrictions and availability.  It is an error to use this option
             in conjunction with the -l option.

One of their examples is

    nc -l 1234

I tried with your example of "nc -l -p 1234" and it comes up immediately with usage instructions.

It looks like you should not be specifying the -p option. Just try

  nc -l 1234 | dd of=/dev/sda

I haven't used the dd command so I cant vouch for the rest of the command but it seems you have the wrong syntax for the nc command.

Andrew
Avatar of oxygen_728
oxygen_728

ASKER

Dual,

In the debian flavor of Linux, i've been using nc -l -p 1234.  A single -l flag indicates "listen mode" and -p #### specifies the port.

Regardless, I did test the command that you suggested. This resulted in all incoming connections being rejected.


ASKER CERTIFIED SOLUTION
Avatar of oxygen_728
oxygen_728

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer