Trying to use the dd command
Hi i am trying to use the dd command to create an iso of my Ubuntu machine but am having some problems with the syntax trying to do it using an external hard drive as the file location.
can anyone help me out? |
the general syntax is usually:
Code:
dd if=/path/to/input/file of=/path/to/output/file bs=blocksize if i understand your question correctly, your if should be the disk that your ubuntu is installed on (what does df -h print out for you ?). i htink your of would output to some new file on your external drive (i think the same df output above would give us an idea of that). before dd-ing, consider filling the drive with logical zeros so that it compresses better. this is what i do: Code:
dd if=/dev/zero of=tmp.zero; rm tmp.zero |
thank you for the quick response but im still a little confused, what blocksize should i use and where do i point the command to copy the whole machine input or output?
|
Let's back up a bit here and determine if dd is even the right tool for the job.
What drive are you trying to back up, and to where are you backing it up? What is on the drive being backed up? How big are the source and destination drives? What, exactly are you trying to do, and for what purpose? What's the end goal? It is VERY easy to destroy the data on your drive and render the system unbootable with dd. And if you have to ask these kinds of questions, it's pretty doubtful that dd is even the right tool in the first place. |
i edited my post above. blocksize isnt important (i think it helps with making it run faster) and depends on a lot of variables, cpu speed, how many cores, how much ram, type of harddrives, ...
start by running this command: Code:
dd if=/dev/zero of=tmp.zero; rm tmp.zero |
So, I am not looking to hijack this question, however I to am a novice with dd (have basic understanding and have copied stuff to use and so on).
My additional question is, how do you only copy the data (ie. actual disk is say 20GB but only 15GB in use)? ... or is this suicidaleggroll's point that dd may not be the correct tool in this example? |
septym,
the location will be the mount point, perhaps /media/New Volume If you refer to that put New Volume in single quotes becuase of the gap. No expert on anything, much less dd but it does seem to copy "literally" from one place to another given certain peramiters match: https://en.wikipedia.org/wiki/Dd_%28Unix%29 It is also running and changing at the same time (the booted distro) Perhaps a bootable G4Liux (ghost for linux) disk to copy it elsewhere. You could try cloning it to another usb hdd in a caddy, take it out of caddy and put it in the pc. Fred. |
Are you trying to create an iso image from data on your drive or just use dd to copy? If the former, you should use mkisofs or genisoimage to do that.
|
Quote:
my idea of creating a dummy file full of /dev/zero's to fill up the disk should help with compressing it since unlinked files will be overwritten. |
Quote:
|
Sounds like the wrong tool for the job in hand.
dd copies disc blocks/sectors, not files. To make an .iso (cdrom) image you use mkisofs/genisoimage, however if it is to be a dvd, you use growisofs, then you 'burn' it to disc. If you are wanting to back up your files, I would either copy to another disk or use tar, then back that up. There is no reason to copy/backup your operating system, as you can just re install it. |
Quote:
Quote:
We need to wait for the OP to respond with his goals before this thread can really continue though... |
"dd" comes from "disk to disk copy", so that is just what it does. It copies its input (file, pipe, partition, disk, tape) to its output (likewise file, pipe, disk, tape or partition) without any comprehension of what it is doing. It will happily copy a file onto a disk, or a partition or read from a tape into a file.
When copying files it does have the useful property that you can force it to copy part of a file (starting at an arbitrary point), or even to copy more than a file. This is the standard way to generate large scratch files such as new swap files. For instance, from the mkswap(8) man page: Code:
# dd if=/dev/zero of=swapfile bs=1024 count=65536 dd can also perform manipulations such as ASCII <-> EBCDIC or swapping bytes. |
Quote:
|
All times are GMT -5. The time now is 05:44 PM. |