LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Ubuntu Newbie...need to clone drive and store data on external drive (https://www.linuxquestions.org/questions/ubuntu-63/ubuntu-newbie-need-to-clone-drive-and-store-data-on-external-drive-790072/)

Mike31718 02-18-2010 07:49 PM

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

jiobo 02-18-2010 08:06 PM

Quote:

Originally Posted by Mike31718 (Post 3868844)
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.

damgar 02-18-2010 08:22 PM

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.

Mike31718 02-18-2010 08:52 PM

Quote:

Originally Posted by jiobo (Post 3868856)
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.

Mike31718 02-18-2010 08:56 PM

Quote:

Originally Posted by damgar (Post 3868861)
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...

damgar 02-18-2010 09:21 PM

Each disk has one partition? sda1, sdb1, sdc1? What file system is the unrecognized drive formatted for?

Mike31718 02-18-2010 09:28 PM

Quote:

Originally Posted by damgar (Post 3868905)
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.

damgar 02-18-2010 10:18 PM

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.

Mike31718 02-18-2010 10:30 PM

[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

damgar 02-19-2010 12:35 PM

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.

tommcd 02-20-2010 07:52 AM

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.

Mike31718 02-20-2010 12:32 PM

[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.

damgar 02-20-2010 04:07 PM

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.

Mike31718 02-23-2010 06:42 PM

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

Mike31718 02-24-2010 11:25 PM

Quote:

Originally Posted by damgar (Post 3870869)
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


All times are GMT -5. The time now is 08:30 AM.