I've been trying to get CUDA to work on my system and in the process of messing with nvidia drivers I have broken ubuntu badly enough that I've had to reformat my drive partition multiple times. I've now been hit with that stick enough times that I'm trying to back up my partition once I've installed all my tools and programs and stuff, using dd (as recommended by a friend).
However, when I ran
sudo dd if=/dev/sda4 of=~/backup.img
I eventually got an error that my drive ran out of space. This was strange to me, since the partition is quite large and I have just a fresh ubuntu install along with a few (small) programs on it.
I figured what might be happening is that it was recursively trying to write a copy of what it had already written, so I tried writing the file directly to another partition instead:
sudo dd if=/dev/sda4 of=/media/Ye Olde Data/ubuntu reinstall backup/backup.img
But this took forever and I aborted the process once the file got to a size I was pretty sure was too big to contain only the data I wanted.
What is happening? Is it that /media has the other partitions mounted and thus it's treating the other partitions as part of /dev/sda4? Is it that dd copies the entire partition byte-for-byte, ignoring what bytes actually have files on them?
And whatever the case, how can I do what I am trying to do, correctly?
Oh, and here's my disk information, in case it matters:
sudo sfdisk -l /dev/sda
Disk /dev/sda: 62260 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 12- 13- 102400 7 HPFS/NTFS/exFAT
/dev/sda2 12+ 14602- 14590- 117187500 7 HPFS/NTFS/exFAT
/dev/sda3 29192+ 62260- 33069- 265622493+ 5 Extended
/dev/sda4 14602+ 29191- 14590- 117193728 83 Linux
/dev/sda5 61228+ 62260- 1032- 8287232 82 Linux swap / Solaris
/dev/sda6 29192+ 61227 32036- 257329138+ 7 HPFS/NTFS/exFAT