What dd command do i use to convert a 1TB image file back to files/directories?
I know it should be the opposite of the command i used to create it, but that was a long time ago and i do not know which command was used.
|
It depends upon exactly what you want to achieve.
You can use dd to write the image back to disk, but you'd have to be careful to not overwrite partition boundaries, etc. If you want to extract data from the image, you can mount it via loopback and then copy files across. Eg: Code:
# mount -o loop ./imagefile.img /mnt/loop |
Quote:
You could use the file command to guess what kind of file it is. The filename may also provide a clue. Once you have an idea of the file's format, you will know which tools to use to open it. |
Shouldn't mount just recognize the type in most cases?
I.e. Code:
# mount -v ./imagefile.img /mnt/loop |
I used something like
Code:
sudo dd if=/directory/filename bs=8M of=filepath/newfilename I want to get all of the thousands of file/directories back in a NON image format and save it to a new directory on my hdd which does not take up the whole hdd or, ideally, have to create a new partition. rather, use the existing partition and just make a new directory to transfer the files to. My guess is: Code:
sudo dd if=/media/filename bs=8M of=/dev/sdx#/new.directory.name Code:
sudo dd if=/media/directory.name/filename bs=8M of=/dev/sdx#/new.directory.name |
Quote:
Quote:
Quote:
If this is indeed a filesystem image, you don't need to copy it to a partition. Just mount it as suggested above. |
Quote:
Before you can mount an existing partition from the image file you need to know the byte offset of a partition from the beginning of the drive since you can not mount an entire drive image. The kpartx utility does all that for you and automatically creates the loop devices. Code:
kpartx -a -v myfiles.img |
|
Quote:
Code:
sudo dd if=/dev/sdx bs=8M of=/filepath/directory.name |
Quote:
|
Quote:
|
/dev/sdx is the entire disk plus the partition table. Writing the file back to a physical disk would erase everything on that disk.
|
Quote:
|
Quote:
|
Missed your last post.
You can't use the dd command to restore the files and if you do not want to over write the drive then as suggested mount the filesystem image file and copy the files. |
If you can access the files in the image then attempting to do a restore with dd instead of copying them back would be a lot of wasted time and drive space as well as headaches. I wager you have considerably less space used by the files than the 1 TB in the image.
|
Quote:
I don't think you can work on fuse filesystems with dd. Quote:
You have an exact copy of the whole hard drive as a 1TB file. Quote:
Code:
sudo dd if=/filepath/directory.name of=/dev/sdy |
Quote:
Appreciate the help. |
Quote:
|
Quote:
|
Quote:
Code:
man mount https://linux.die.net/man/8/mount You can mount an .iso loopback |
Also,
If you want to make a pdf/text from a man page for easier reading Code:
man -t mount | ps2pdf - output.pdf Code:
man mount | grep -- 'loop' Code:
man mount | grep -A 10 'LOOP' |
Quote:
Aren't we going in circles now? Yes, the answer is yes, but it might not give the desired result. Anyhow, I think I'm out. |
Quote:
Code:
$ sudo mount <image-file> /mnt -o ro -o loop I can only recall one instance where I've used `dd' in a backup/restore situation and that involved Oracle raw data partitions and magtape---not regular filesystems. HTH... |
All times are GMT -5. The time now is 06:06 AM. |