LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 02-18-2010, 07:49 PM   #1
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Rep: Reputation: 0
Question Ubuntu Newbie...need to clone drive and store data on external drive


Guys, I am new to this site but just desperate enough to put this whole story out to see if anyone can help.
I have a pc loaded with windows, I am booting with a Ubuntu cd I burned from a downloaded iso. I have connected the drive that I wish to copy and a 500gb external drive and they are both seen. The drive I wish to copy is present but not recognized. (I don't know if that is an issue for this particular situation or not).
Without going into too many details, I wish to clone/create a disk image of the attached drive much like an iso and then restore it at a later time. There is data on the external drive so I don't want to risk losing it. I was told that I could use the dd command to accomplish this but I know NOTHING about Linux or Unix. I am looking for a "hand holding" moment here as I attempt this. I have seen some very detailed and helpful threads on this site and was convinced that someone here could help. Let me be very clear, I know NOTHING about Linux/Unix. You cannot be too detailed or condescending in your replies. The disk I am attempting to copy has some very important data on it and I must save it. Thanks, Mike31718
 
Old 02-18-2010, 08:06 PM   #2
jiobo
Member
 
Registered: Nov 2008
Posts: 180

Rep: Reputation: 36
Quote:
Originally Posted by Mike31718 View Post
The disk I am attempting to copy has some very important data on it and I must save it.
No need to clone the entire disk. Just save the important data. If the disk is not recognized, that is a problem.
 
Old 02-18-2010, 08:22 PM   #3
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
Quote:
I have connected the drive that I wish to copy and a 500gb external drive and they are both seen. The drive I wish to copy is present but not recognized
Can you be a little more clear? This seems to be contradictory. How many drives in total are physically present.

Also posting the output of
PHP Code:
sudo fdisk -
will help people help you. To do this:
open a terminal (probably under applications)
type the command, then copy and paste the output in your reply.
 
Old 02-18-2010, 08:52 PM   #4
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jiobo View Post
No need to clone the entire disk. Just save the important data. If the disk is not recognized, that is a problem.
I can see it and the sudo fdisk -l command shows it present. However, System/Administration area states that the drive is unrecognized. The utility for the drive says that it is healthy and checks out.

Last edited by Mike31718; 02-18-2010 at 08:58 PM.
 
Old 02-18-2010, 08:56 PM   #5
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by damgar View Post
Can you be a little more clear? This seems to be contradictory. How many drives in total are physically present.

Also posting the output of
PHP Code:
sudo fdisk -
will help people help you. To do this:
open a terminal (probably under applications)
type the command, then copy and paste the output in your reply.
To be clear, this is a pc with a 40 gb hard drive hosting windows os, I have attached an additional drive that I wish to copy and an external drive that has the capacity to hold the data.

The PC drive shows up as /dev/sdb
The attached drive shows up as /dev/sda
The external drive shows up as /dev/sdc

Hope this helps...
 
Old 02-18-2010, 09:21 PM   #6
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
Each disk has one partition? sda1, sdb1, sdc1? What file system is the unrecognized drive formatted for?
 
Old 02-18-2010, 09:28 PM   #7
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by damgar View Post
Each disk has one partition? sda1, sdb1, sdc1? What file system is the unrecognized drive formatted for?
Yes, each disk only has one partition. sda1, sdb1, sdc1. I do not know what the unrecognized drive is formatted with (does FAT16 sound right?)but I was told that doing the dd command would copy bit by bit and that formatting was not important for that process.

Last edited by Mike31718; 02-18-2010 at 09:46 PM.
 
Old 02-18-2010, 10:18 PM   #8
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
dd doesn't need to know. I was curious. Here's a good link for you.
http://www.linuxweblog.com/dd-image
It shouldn't be hard to adjust the commands there.

Just for reference there are some really handy tools for backing up and restoring disks. My favorite is FSArchiver which is found on the SystemRescueCD available at

http://www.sysresccd.org/Main_Page
http://www.fsarchiver.org/Main_Page

But dd will definitely do what you want.
 
Old 02-18-2010, 10:30 PM   #9
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
[QUOTE=damgar;3868938]dd doesn't need to know. I was curious. Here's a good link for you.
http://www.linuxweblog.com/dd-image
It shouldn't be hard to adjust the commands there.

Now we get to the crux of the issue. I don't understand the commands that are present on the link you sent me. I need to be sure that whatever I am doing is not going to effect the external drive that I have attached to the machine. Will it write to a specified folder or simply write openly to the USB drive that I attached? I have to be very cautious at this point before I attempt this.

PC drive shows up as /dev/sdb
Attached drive shows up as /dev/sda (drive to be copied)
External (USB)drive shows up as /dev/sdc (target for data storage)

With these identified, how do you see these commands...correct/need changes?

It says to mount the USB drive but do I have to since Ubuntu can already see it?
-t vfat /dev/sdc1 /mnt/sdc1

Then the backup (where does the "hda" come into play?)
# dd if=/dev/hda conv=sync,noerror bs=64k | gzip -c > /mnt/sdc1/hda.img.gz

Then to restore
# gunzip -c /mnt/sdc1/hda.img.gz | dd of=/dev/hda conv=sync,noerror bs=64k

Last edited by Mike31718; 02-18-2010 at 11:08 PM.
 
Old 02-19-2010, 12:35 PM   #10
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
Quote:
Now we get to the crux of the issue. I don't understand the commands that are present on the link you sent me. I need to be sure that whatever I am doing is not going to effect the external drive that I have attached to the machine. Will it write to a specified folder or simply write openly to the USB drive that I attached? I have to be very cautious at this point before I attempt this.
Catuion and dd are perhaps a little exclusive , but for what it's worth, I like to create a small partiton to write backups to. It isolates the current data and makes it less likely that I will overwrite the backups later.

PHP Code:
sudo cat /etc/mtab 
will tell the mount points of the drives/partitions IF they are mounted.... Detecting a drive and mounting a drive are two different things. It is also possible to mount them using the partition editor under System -> Administration. The drive you are writing to needs to be mounted before you can write to it.

Once you have the drive mounted in say /mnt/BACKUP then you can do something like:
Code:
#create backup directory
mkdir /mnt/BACKUP/backup_images
#write image
dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c  > /mnt/BACKUP/backup_images/attached_disk.img.gz
which will create a directory in the root of the attached drive called backup_images and then write a compressed image to the directory called /backup_images.
Quote:
Backup the drive.

# dd if=/dev/hda conv=sync,noerror bs=64K | gzip -c > /mnt/sda1/hda.img.gz


"dd" is the command to make a bit-by-bit copy of "if=/dev/hda" as the "Input File" to "of=/mnt/sda1/hda.img.gz" as the "Output File". Everything from the partition will go into an "Output File" named "hda.img.gz". "conv=sync,noerror" tells dd that if it can't read a block due to a read error, then it should at least write something to its output of the correct length. Even if your hard disk exhibits no errors, remember that dd will read every single block, including any blocks which the OS avoids using because it has marked them as bad. "bs=64K" is the block size of 64x1024 Bytes. Using this large of block size speeds up the copying process. The output of dd is then piped through gzip to compress it.
This is from the how-to that I modified to be specific for your case. It explains what all the options mean

I still prefer FSArchiver when it can be used, because it is only going to copy the USED blocks of the disk, thus saving a ton of space even before the compression stage. There are a number of good tutorials on the links I posted above.
 
Old 02-20-2010, 07:52 AM   #11
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 291Reputation: 291Reputation: 291
Mike31718,
You could try using a Clonezilla live CD. This is a live CD that you run from the cdrom drive similar to the Ubuntu live CD. Clonezilla can clone a hard drive for you.
Read about Clonezilla here: http://clonezilla.org/
The Clonezilla live CD is here: http://clonezilla.org/clonezilla-live/
And examples of how to use Clonezilla is here: http://clonezilla.org/clonezilla-live/doc/
I have never actually used CLonezilla. I have read it works well though.
 
Old 02-20-2010, 12:32 PM   #12
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
[QUOTE=damgar;3869640]Once you have the drive mounted in say /mnt/BACKUP then you can do something like:
Code:
#create backup directory
mkdir /mnt/BACKUP/backup_images
#write image
dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c  > /mnt/BACKUP/backup_images/attached_disk.img.gz
which will create a directory in the root of the attached drive called backup_images and then write a compressed image to the directory called /backup_images.
This is from the how-to that I modified to be specific for your case. It explains what all the options meanQUOTE]

I really appreciate that you are being so detailed and have attempted to explain all of this. However, before I do this, I have to be very clear with what I am doing.
The reason that I am having to do this a certain way is that I am salvaging my Directv harddrive that contains data that I cannot lose. In my research, "Unix dd" is the only successful way to be able to capture the data and restore it to the disk without the machine knowing what has happened. I am not pirating anything, this is a result of stupidity on my part that I mistakenly started the machine resetting the default settings which would have wiped out the harddrive if I had not intervened to save it. I need to capture the data from the disk, place the disk back in the machine and let it do it's re-format, and then be able to restore the image to the disk. This is why I am trying to be very cautious. I do need the "bit by bit" solution that dd offers so that the machine will recognize the disk.
I have questions about what you sent me so please give me further explanation...
I tried running the command that you gave me and I get access denied on the "sda" drive. Do I need to somehow mount it as well? Remember, I don't want to effect the data on this disk at all. Please sent me the mounting commands.
Thanks.
 
Old 02-20-2010, 04:07 PM   #13
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
You will probably have to append sudo to the dd command like
Code:
sudo dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c  > /mnt/BACKUP/backup_images/attached_disk.img.gz
because of permissions. Further, you can do
Code:
sudo ls -alt /dev/sda
to view the permissions of the drive.

And still further you might have to do
Code:
sudo chmod  -R 777 /dev/sda
to set permissions on the drive to make sure that both the copy and reformat are allowed to happen, however this last bit may or may not mess something up. I have absolutely zero idea what kind of security the DVR might have in place.

I would like to know if any of this actually works for you in the end since I sometimes contract for satellite TV providers and have been asked questions 1919123918247912 times regarding what you are attempting to do.
 
1 members found this post helpful.
Old 02-23-2010, 06:42 PM   #14
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Guys,
I have decided to seek Professional Help on this. I cannot get this to work on my own so I think it is time. I appreciate all the input you have made in this effort and will post the results to this forum when the diagnosis is in. Again, thank you for your patience as I dealt with this.

Mike31718
 
Old 02-24-2010, 11:25 PM   #15
Mike31718
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Unhappy

Quote:
Originally Posted by damgar View Post
I would like to know if any of this actually works for you in the end since I sometimes contract for satellite TV providers and have been asked questions 1919123918247912 times regarding what you are attempting to do.
damgar, my guy says that it IS possible to do this!...just not for my disk.

So it's the end of the road folks. The professional help says that the data was severed when the machine attempted to reformat the disk. To pursue this further is too cost prohibitive. The only possibility is forensic restoration and I don't know anyone even capable of that. So thank you for your efforts. May God bless you as you bless others with your knowledge.
Thanks again,
Mike31718
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Easiest way to Clone/image an Ubuntu drive rmcellig Linux - Newbie 30 09-11-2009 09:04 AM
How to Clone an Ubuntu Linux drive using dd and is it the same as Ghost suave Linux - Newbie 4 01-29-2009 10:20 PM
ubuntu installed on external hard drive, can't startup without external hard drive. Vanostaajen Linux - Software 23 01-20-2009 09:59 AM
How do I have EVOLUTION store data to USD drive? trapix22 Linux - Software 0 04-27-2007 08:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration