Solved

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

Posted on 2008-06-11
3
793 Views
Last Modified: 2013-12-16
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
0
Comment
Question by:oxygen_728
  • 2
3 Comments
 
LVL 2

Expert Comment

by:dualarrow
ID: 21766255
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
0
 

Author Comment

by:oxygen_728
ID: 21769864
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.


0
 

Accepted Solution

by:
oxygen_728 earned 0 total points
ID: 21771732
See this post for a detailed answer:
http://www.experts-exchange.com/OS/Linux/Q_23479648.html

Basically, my hard-drive was broken and it should be a simple matter to write directly to a drive such as /dev/sda with dd

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now