-1

EDIT: I have reviewed the "Duplicate claim" and to be frank, it is not answering my query, like most of my questions, the existing duplicate question do not answer my query.

Besides that, I am dumping Ubuntu as I am sick and tired of the persistent issues with it, things working one day then not the next and everything breaking after each update and I do believe the main reason I can't update is due to my system being knobbled :)

So enough is enough, I have found a stable version of software that does not contain spyware like Ubuntu does.

Happy smoking guys.

Ciao.


I have asked a couple of times on how to go about this cloning of a drive, I have been advised to use dd or cat but neither work, well dd worked but not as expected. The command I used was:

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

The result was an unusually large container (51.3GiB) for a very small image file (3.9GiB) and it took more than 10 hours to do. I was able to copy data from the drives with copy and paste in about 45 Minutes before I unmounted for the drive image to be completed.

So, to set things straight from the outset...

Drive to be copied - SSD drive, 64GB on the tag, has two partitions, is referenced as /dev/sda/ with /dev/sda2 as the boot partition NOT MOUNTED

Drive to have image dumped to - USB HDD, 2TB on the tag, has one partition with 144MB buffer at the end on /dev/sdc1 IS MOUNTED

The drives copied from and copied to are not used as a boot drive, the boot device/partition is on /dev/sdb1 (which is an SD Card) and neither device is used during the process. Yes the sda drive is unmounted, had to repeat that point as the first time around it may have been missed.

Each time I am told that I should use dd if=/dev/sda | gzip -c > "/media/mark/Seagate Expansion Drive/ssd.img.gz" the image results in a very strange file that is 51.3GiB and in that file is a 3.9GiB file thats the image!?!?! Ummm the drives are nearly full!

Each time I try to do this using ZIP which is what I want and thats so I can access in Windows should I need to do a blanket reinstall and pull the files I need from the ZIP file, however when I use dd if=/dev/sda | zip "/media/mark/Seagate Expansion Drive/ssd.img.zip" I get a message that the program has nothing to do!

I have tried the same with the cat command and that results in errors stating that "nothing to do!" and despite pointing out my needs, I get answers that would over write the existing partition, not what I am looking to do.

Yes "I have the ZIP libraries", yes "the drive to write to is mounted", no "the source drive is not mounted", I have no storage issues, so the ZIP can be uncompressed format.

Can someone help please?

** EDIT **

Excuse me for getting frustrated BUT does Ububntu have ANY software that works?

My problem is very simple to follow, I have an SSD that is 64GiB in size, it is about 98% full.

I have followed examples online and by advice from here in askubuntu and everyone posts stuff like I have previously posted.

The image file made using dd resulted in a 51.3GiB file called ssd.img.gz, within that gz archive a file called ssd.img resides and it is 3.9GiB in size.

NOW FORGET ALL THAT ABOUT THE CONTAINER...

I want to make an image of a drive that can later access in a ZIP program, I have gzip and zip libraries, my preference is ZIP because windows can read ZIP files without any external program.

How can I make a useable drive image that I can verify as being the same so I can then repair / break the drive with the confidence that I can restore the contents as it once was.

How can I do that please?

  • I possibily don't understand the problem. You start with a 64GB partition (/dev/sda), you copy it to an image (with dd, it will be again 64GiB) and then you gunzip it (with gzip) and what you obtain is a 51.3 GiB file. To me it seems reasonably that gzip compresses a 64GiB file to a 53.1GiB, so I don't understand why doesn't it seem right to you? – dadexix86 Mar 03 '15 at 12:33
  • 1
    If I read correctly the OP is saying that he has a ssd.img.gz which is 53.1 GB (reasonable) but that the contained file is 3.9GB. Is this correct? How do you now which is the size of the "contained" file? (gzip is NOT a zip file --- completely different structure). I mean, gzip -c do not create any container; its output is simply a stream of bytes. – Rmano Mar 03 '15 at 13:28
  • As for this post ...

    This question may already have an answer here:

    GZip of drive image created by using `dd` command 2 answers
    
    

    No it hasn't, didn't work, the preferred archive type says "Nothing to do!" when actioned with dd or cat.

    – Mark Giblin Mar 03 '15 at 14:17

2 Answers2

3

I think you are asking to be able to open this zip file and see the list of files in windows explorer when you browse into the zip.

You are using the words 'image file' which has meaning of which you may not be aware. An image file is not something one can introspect without special tools. This is in direct contrast to the request for a zip file with which one can browse files. You seem to not want an image of a disk, you seem to want a zip file with all of that disks file contents.

There are a number of reasons why this is a bad idea, and why you have not received the answer you want.

  1. Zip format does not support unix devices. This means none of /dev/ will work and you cannot use this file to restore your system.
  2. Zip format does not support unix file permissions. This means that most of your system will not work since executable files will not be marked as executable.
  3. Zip format on non-unix does not support symlinks, it will not work.
  4. Zip format does not support extended attributes. This is probably OK for simple use cases, and is another reason why we use tar and not zip.
  5. This is not the standard normal unix, linux or ubuntu way of doing things.

Those things aside, here is how to zip your filesystem:

zip -ry '/media/mark/Seagate Expansion Drive/ssdfiles.zip' /

It will likely not work because it uses /tmp, which will likely be full on your system, so tell it to use that same external drive as tmp using -b

zip -ry -b '/media/mark/Seagate Expansion Drive' '/media/mark/Seagate Expansion Drive/ssdfiles.zip' /

Good luck.

1

You can make the plain image file with:

dd if=/dev/sda of=/path/to/outputfile.img

Don't append the .zip at this stage. If you wish to reinstate this on a spare partition (sdx in example) to check it against the real /dev/sda, then:

dd if=/path/to/outputfile.img of=/dev/sdx

Once you're happy that this is a good image (perhaps compare using diff command) then you should be able to zip your .img file, which will not have been affected by the previous dd command. Then:

zip /path/to/outputfile /path/to/outputfile.zip

Of course you can change filenames at any point.

Arronical
  • 19,893
  • Success I hope: root@mark-zotac:~# dd if=/dev/sda of="/media/mark/Seagate Expansion Drive/ssd.img" 125045424+0 records in 125045424+0 records out 64023257088 bytes (64 GB) copied, 35255.5 s, 1.8 MB/s I will compare the drives for any difference after trying to mount the image. – Mark Giblin Mar 04 '15 at 02:37
  • You don't need to overwrite another drive/partition (sdx in your example) just to compare it; you can mount the image directly - though if it's not a separate partition (it's an sda instead of an sda2, etc) you may need an additional step to find the partitions it contains before mounting them – Xen2050 Jan 09 '16 at 21:00