[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Linux - Hard Drive DD Question - restoring a backup to a larger drive?

Posted on 2008-06-12
3
Medium Priority
?
1,055 Views
Last Modified: 2013-12-16
Let's say that I backup a hard drive like so:


This sends a backup of a 75GB hdd to a receiving computer
dd if=/dev/sda | nc IP PORT

Now let's say I buy a 150 GB hdd when the 75GB hdd fails

Time to restore the backup (computer receiving data onto the new hdd)
nc -l -p 1234 | dd of=/dev/sda


1. Can I write directly to a drive like this? (I know the first command works, but what about the second? I'm concerned about writing to an unmounted drive, even though I can read from it)

2. What happens to the other 75 GB of the new hard drive that don't get filled up with data? Will this drive even be usable?

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

Accepted Solution

by:
ktd85 earned 2000 total points
ID: 21770425
1. The writeback like you discribed with your second command should succeed fine.
2. After restoring the Backup with you second command you should extend the partition using fdisk and extend the filesystem.
You can only extend the last partition on the harddrive without using tools like gparted.

If you use gparted you can change to size of any partition.
0
 

Author Comment

by:oxygen_728
ID: 21771049
ktd, thanks for the advice and information. I was starting to get worried about being unable to write back to a hard-drive... I originally thought this hard-drive had corrupted data, but now I think the hard-drive is broken. I'll try another drive.

Thanks for your time,

0
 

Author Comment

by:oxygen_728
ID: 21771457
ktd85, I have great news to round out this question. I'm going to provide some info to anybody else who stumbles across this question that was in a similar situation.


I hooked up an old 250gig hard drive in place of the suspected-broken 75gig HDD.

I issued this command on the backup-pc: dd if=backup.img | nc IP Port
I issued this command on the receiving-pc: nc -l -p 1234 | dd of=/dev/hda

It's working.

Furthermore, I moved over to use dd_rescue which provides some great run-time output:

backup-pc: dd_rescue -b 65535 -v backup.img.gzip | nc IP Port
Receiving PC: nc -l -p 1234 | gzip -cdf | dd_rescue -v - /dev/hda

This takes the gzip'd 75gig-HDD backup and sends it across the network to the receiving PC (The PC that is receiving the back). When the receiver receives data, the data is decompressed and fed through dd_rescue to the new hard drive.


backup-pc is running ubuntu server 6 with dd_rescue apt-get installed with a 1 terabyte usb hard drive mounted

receiving-pc is running trinity rescue live cd, booted in default mode.

If there are any questions on how to do this, post to this question and i'll try to help out


Thanks again for the help ktd85
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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,…
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…
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

650 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