Create Disk Image of a Drive's Partition Using dd Commands

Just wondering how to create disk images of a drive’s partition using dd commands.

https://wiki.archlinux.org/index.php/disk_cloning
is decent resource

Any way of doing it to create an IMG/ISO file rather than gzip?

yeah, you use out file and give a file arg. like below, of= is out file, out and in

dd if=/dev/sda of=/home/user/place/file.img bs=4M status=progress

every thing is a file in linux. so out in file of drive to out file of whatever. you can out file as .img format or pipe it to an archive utility

dunno if iso will work though since that implies a filesystem(usually) so some programs may have issues, but img should be fine/could always rename the file anyways

Trying to get it working with img, not having much luck

dd if=/dev/sda of=/home/user/place/file.img bs=4M status=progress

would be whole drive where changing the if= to if=/dev/sda1 tells it to copy the first partition, you can list partitions with something like Gparted to make sure your using the right partition

or use ls and grep to list your dev if you know what you are looking for

ls /dev | grep sd

whats the command you used?

I think you’re on to something.

I tried

dd if=/dev/sda1 of=/dev/sdb1/home/liveuser/desktop/EFI.img

but it’ll say that the output directory doesn’t exist.
I’m booted into a live Fedora USB, not sure if that matters.

possibly this part, is it ‘persistent’ as in could you put a file on the desktop and reboot and have it still be there?

else might not be mounted in a way you can write, as if it was say booting off a dvdrom,

if you have a spare drive or something can always try creating a directory like /mnt/temp to mount that other partition to, and then write it to there

FUCKING…

my godddddddddd…

It’s case sensitive that’s why it didn’t work

FUCKIN… -.-

edit- solution for reference:
dd if=/dev/sda1 of=/home/liveuser/Desktop/FileName.img

1 Like

everything is in linux lol

ohhhhhh

5char

Thank you guys so much. This is going to help a ton.

No problem,

come back if other issues

hey, i didnt really read that, your telling to take sda1 and write it over sda1

you would want it to be the file only on the of= so give it a path like this of=/dir/dir/dir/file.typ

dd will do what you tell it. ive been using it for years and i still slowly read and say out loud in and out as i read it to be daaaamn sure im not fucking up a drive or file

maybe misread?

says of=/dev/sdb1

for me

edit:
although… would usually send the output through the mount point if writing a file(not sure if will cause issue or not really though)

1 Like

I was specifying the device to send the file to in the of= output. If it’s wrong how would I properly add that to it? I’m trying to find the full length directory of the Desktop folder on the live USB, but all it’s saying is “home/liveuser”.

is probably ‘/home/liveuser’
edit: with /dev/sdb1(or whatever drive/part) mounted as ‘/’

you can check /etc/fstab, /etc/mtab, df, mount etc