Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

911 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

19 Experts available now in Live!

Get 1:1 Help Now