I'm trying to create a disk image using the dd command however it saves the image in my home directory and it's obvious the hard-drive is going to run out of space. I have an external usb hard-drive, but how do I save the image file directly to the usb hard-drive and not first saving it in the home directory.
This is the command I'm using:
dd if=/dev/sda of=~/disk1.img <-- Stores image file in home directory.
I want the disk1.img to be stored into /dev/sdb1 not the homedirectory.
-
corbintechboy Notebook Consultant
dd if=/dev/foo of=/foo/foo/fooimage
might need sudo
So in your case:
Code:dd if=/dev/sda of=/dev/sdb1/disk1.img
-
Code:
dd if=/dev/sda of=/dev/sdb1/disk1.img
Code:dd: opening `/dev/sdb1/disk1.img': Not a directory
Code:dd if=/dev/sda of=/dev/sdb/disk1.img
Code:dd if=/dev/sda of=/media/foo/disk1.img
-
corbintechboy Notebook Consultant
Try running Ubuntu live and doing the backup.
-
-
corbintechboy Notebook Consultant
On your drive you would have a directory (maybe backup) to place the backup.
You can just do /dev/sdb1 without a directory, and /dev/sdb1 needs to be mounted. -
I'm a linux noob, you need to slow down. When I plug my external harddrive in it automatically mounts to /media/foo. How do I mount this thing to /dev/sdb? If that's what your saying?
-
Wait a minute I think my external drive has fat filesystem so I think thats the reason it stops at 4GB right?
-
corbintechboy Notebook Consultant
Code:dd if=/dev/sda ("sda" is wherever you want to backup) of=/dev/sdb1/disk1.img (this is wherever it is mounted, could be "of=/media/whereveritis/disk1.img)
-
corbintechboy Notebook Consultant
-
Thanks Corbin, my file now is able to exceed 4GB.
-
corbintechboy Notebook Consultant
.
-
Creating a raw image with dd from withing the running system will most likely cause trouble when restoring the image because of the inconsistencies that are caused by the file system write between start and stop of the copy process. Backups are quite pointless if you don't know for sure that they'll work.
If you really want to make an image copy with dd always use another system (e.g. a live CD).
But I guess instead of saving an image it would be more reasonable to only save your personal data. This can very easily be done with rsync. There are also graphical frontends available like Grsync. Others report that Unison works quite well, but I have no experience with it.
Disk image using dd command
Discussion in 'Linux Compatibility and Software' started by graycolor, Jan 23, 2011.