Solved

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

Posted on 2008-06-11
3
795 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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.

773 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