rye004
asked on
Can you use the DD command on a directory in Linux?
Is it possible to use the DD command to create and image of a directory? I realize that the DD command is traditionally intended to create a copy of data on a piece of media and that if is in allocated or unallocated space is irrelevant. What I am looking for is a bit stream of data from allocated data within a directory.
If I should use another command please let me know. Any examples would be greatly appreciated.
If I should use another command please let me know. Any examples would be greatly appreciated.
ASKER
Thank you for your response. I had tried your example before I posted and all I got was an empty file. The DD command indicated that what I was trying to DD was a directory.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
dd command cannot be used for copying / imaging a directory.
on unix / linux, a directory is a especial file that contains info about subdirs and files under that dir.
so, when you dd a dir then dd will just copy that especial file and not the full directory content.
you could use command like tar
tar -cvf /somedir/mydir.tar /path/to/mydir
but make sure you have enough space on /somedir
to restore it
tar -xvf /somedir/mydir.tar
on unix / linux, a directory is a especial file that contains info about subdirs and files under that dir.
so, when you dd a dir then dd will just copy that especial file and not the full directory content.
you could use command like tar
tar -cvf /somedir/mydir.tar /path/to/mydir
but make sure you have enough space on /somedir
to restore it
tar -xvf /somedir/mydir.tar
ASKER
Thank you for your help. This actually makes more sense to use.
dd if=/dev/your folder of=/where you want to output file