Solved

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

Posted on 2008-06-11
3
799 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

739 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