Ubuntu – Copy an image of a disk to an external drive

backupclonedisk-image

Is am trying to make a copy of a file structure (& an image) from a drive that I have identified as

/dev/sda 

(Contains /dev/sda2 and /dev/sda5)

The drive identifying itself as /dev/sdc1 which is an external drive with 1.8TB, has 600+ Gigs of space left. When trying to manipulate it in the GUI all I got was an error saying that the space couldn't be allocated. The drive being copied and imaged is ~64GB.

The source partitions & drive list as not mounted, the target drive is mounted. The device my Ubuntu is on is /dev/sdb1 (the sd card) and is mounted.

dd if=/dev/sda of=/dev/sdc1 conv,noerror,sync 

I know from what has been said in a previous question would copy blah1 on to blah2 but one concern I have is /dev/sdc1 the target has 1.4T of files on it and I don't want to risk that data being overwritten, I need an accessible format, meaning I can open the image and read the content and extract if needed, which is likely to be a daily occurrence.

I saw a site that gave an example

dd if=/dev/sdXY | zip --compression-method bzip2 image-file.zip - 

which is zip, what I need. I don't know how to express the target /path/to/backup.img.gz to put the image in to a folder on /dev/sdc1. Would I be correct in saying that

dd if=/dev/sda conv=sync,noerror | zip --compression-method bzip2 /dev/sdc1 /folder-name/image-file.zip

is that the way to do it?

Also, can an iso be made and mounted? I am looking for the least risky route, the partition 2 in the extended partition /dev/sda2 of /dev/sda has data I need.

Using a terminal, how do I overcome these issues, what's right or wrong with my attempts?

EDIT

I get an error

cat /dev/sda | zip --compression-method bzip2 /media/mark/Seagate Expansion Drive/restore_point_image/restore/kingston_ssd_drive.img.zip
zip warning: name not matched: Expansion
zip warning: name not matched: Drive/restore_point_image/restore/kingston_ssd_drive.img.zip

zip error: Nothing to do! (/media/mark/Seagate.zip)

and trying gzip results in the same error, so I tried to refer to the drive partition by-id with

cat /dev/sda | zip --compression-method bzip /wwn-0x5000c500528232f8-part1/restore_point_image/restore/kingston_ssd_drive.img.zip

and get an error

zip error: Nothing to do! (/wwn-0x5000c500528232f8-part1/restore_point.img.zip)

The 64GB drive was unmounted, the external drive mounter, everything seemed set, but now this!

So I tried to change the drive label and that resulted in a warning that it couldn't be done, I was and still am logged in as root.

Any suggestions?

Best Answer

The error was overcome with the suggestion to "quote" the path

so:

dd if=/dev/sda | gzip - c > "/media/mark/Seagate Expansion Drive/ssd.img.gz"

is currently building an archive (finally).