how do I reverse get rid of things due to dd command
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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
dd if=/dev/zero of=/dev/mapper/asm-data1 bs=4k count=100
100+0 records in
100+0 records out
later I realize that there's something wrong.
Code:
Anand01:~ # ls -l /dev/mapper/asm-*
-rw-r--r-- 1 root root 409600 Mar 26 09:16 /dev/mapper/asm-data-disk1
-rw-r--r-- 1 root root 409600 Mar 26 09:16 /dev/mapper/asm-data-disk2
-rw-r--r-- 1 root root 409600 Mar 26 09:16 /dev/mapper/asm-data-disk3
-rw-r--r-- 1 root root 409600 Mar 26 11:11 /dev/mapper/asm-data-disk4
lrwxrwxrwx 1 root root 8 Mar 26 11:21 /dev/mapper/asm-data1 -> ../dm-27
lrwxrwxrwx 1 root root 8 Mar 26 11:11 /dev/mapper/asm-data1_part1 -> ../dm-37
I realize that asm-data is not an alias i created in multipath.config, i.e. my multipath.config does not consist of these alias.
What should I do to get of the unwanted entries /dev/mapper/asm-data*, i.e. /dev/mapper/asm-data-disk1 to /dev/mapper/asm-data-disk4
I'm using Suse 11.
thanks a lot!
Hmm, the usual way to get rid of a file is the rm command. It works well for both regular files and symbolic links. Somehow I believe this is not what you want, but your question is a bit unclear.
DD(1) User Commands DD(1)
NAME
dd - convert and copy a file
SYNOPSIS
dd [OPERAND]...
dd OPTION
DESCRIPTION
Copy a file, converting and formatting according to the operands.
bs=BYTES
read and write up to BYTES bytes at a time
cbs=BYTES
convert BYTES bytes at a time
conv=CONVS
convert the file as per the comma separated symbol list
count=BLOCKS
copy only BLOCKS input blocks
ibs=BYTES
read up to BYTES bytes at a time (default: 512)
if=FILE
read from FILE instead of stdin
iflag=FLAGS
read as per the comma separated symbol list
obs=BYTES
write BYTES bytes at a time (default: 512)
the original command is meant to test whether we can access each device according to a document. I believe we cannot use the cp command is because we are dealing with disks/blocks. since the create command is dd i wonder if there'a another command to remove the things which dd command created. thanks
The asm-data-disk[1-4] files are ordinary files that do not belong in the /dev/mapper/ directory, but there is nothing that prevents root from creating ordinary files there. You can remove them with the rm command just like any other ordinary file.
The asm-data1 and asm-data1_part1 symbolic links are the type of things that belong there and were apparently created by the device mapper. You should leave those alone. You can use the "dmsetup info" command to get more information about those entries.
'dd' stands for data destroyer ... so no there is no way to directly undo it. Now, you can recreate a partition or partition table if that's what was overwritten, or copy files back from your backups if you have them.
the original command is meant to test whether we can access each device according to a document. I believe we cannot use the cp command is because we are dealing with disks/blocks. since the create command is dd i wonder if there'a another command to remove the things which dd command created. thanks
This seems weird what you're doing.
rm will remove a file or symbolic link. That file is owned by root and has 777 permissions on it, so it should be removable in a normal fashion, actually by any user on the system, providing that user can view the /dev/mapper directory.
Now, /dev/zero is "nothing" you used that as your input file. You specified your output file as a new file. How that file became a symbolic link is nothing I understand or can see why that occurred, my guess is some other actions were performed to make that happen. Not sure if the file was pre-existing and already a symbolic link whether or not injecting /dev/zero into it would've altered it at all. I actually just did a test on a text file, I made a copy, then used your dd command and the result was it did nothing to my text file copy, in fact the copy still matches the original. So, my impression is that /dev/mapper/asm-data1 existed before and you should leave it alone, because it was NOT created by your dd command, it was there all along.
Back to your "access each device according to a document"; what's that mean? Is this a validation procedure where you're trying to satisfy a test criteria? If these are disks, then accessing them means being able to view files, view directories, or view the actual device file(s). Therefore you should be doing nothing related to dd. You should maybe grep for expected content, try to open and view the file, or copy the file to somewhere to verify you can access it and then remove the copy once you've validated you were able to copy one for one.
The /dev/ location is one of those special filesystems. Before udev you would use mknod or MAKEDEV to create entries in that filesystem. With udev the /dev/ path should be mostly empty before you boot. With various hints in /proc/devices and /proc/misc of what should exist if you have to add udev rules or go old school.
Back in the day I would use the wrong redirect or pipe for /dev/null and that would overwrite the device node and create a file that used disk space. Which I had to rm and use mknod or MAKEDEV to recreate /dev/null.
The /dev/ location is one of those special filesystems. Before udev you would use mknod or MAKEDEV to create entries in that filesystem. With udev the /dev/ path should be mostly empty before you boot. With various hints in /proc/devices and /proc/misc of what should exist if you have to add udev rules or go old school.
Back in the day I would use the wrong redirect or pipe for /dev/null and that would overwrite the device node and create a file that used disk space. Which I had to rm and use mknod or MAKEDEV to recreate /dev/null.
Remember the days when "jerks" would try to tell people to sign in as root, cd to / and then type "rm -rf *" to "clean-up" their drive space? (Don't anyone EVER do that! OK?)
Shadow's point, and mine are that you ought to be careful here. All directories aren't just for "play", you know. Or experiment on a throwaway system, not your server or work station which you use everyday for work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.