Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
you would need to be triply cautious that you are referring to the correct disks. there are no training wheels with dd (it will not warn you about overwriting your harddrive irrevocably).
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:
dd if=/dev/zero of=tmp.zero; rm tmp.zero
dd if=/dev/sdb bs=2048 | bzip2 > fc-20.iso.bz2 # to create the image
bunzip2 -c fc-20.iso.bz2 | sudo dd of=/dev/sdb bs=2048 # to restore the image
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.
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:
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.
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?
if you have a brand new 1tb disk with nothing written to it then dd is designed to copy 1 tb worth of logical zeros (or do unwritten disks come from the factory with all blocks = ff ?). dd has no perception of files and directories only block devices and bytes.
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.
"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:
# dd if=/dev/zero of=swapfile bs=1024 count=65536
This creates "swapfile" to be 65536 blocks of 1024 bytes filled with zeros.
dd can also perform manipulations such as ASCII <-> EBCDIC or swapping bytes.
Last edited by J Martin Rushton; 02-05-2015 at 06:24 PM.
Reason: for "disks" in para 2 read "files". sorry.