LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-26-2014, 02:30 AM   #1
redhatwannabe
Member
 
Registered: Dec 2008
Posts: 69

Rep: Reputation: 15
how do I reverse get rid of things due to dd command


Hi

I have done the following

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!
 
Old 03-26-2014, 03:25 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,688

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
Quote:
Originally Posted by redhatwannabe View Post
Hi

I have done the following

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.
 
Old 03-26-2014, 08:18 PM   #3
redhatwannabe
Member
 
Registered: Dec 2008
Posts: 69

Original Poster
Rep: Reputation: 15
Code:
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
 
Old 03-26-2014, 09:04 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,120

Rep: Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345
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.
 
Old 03-27-2014, 01:33 PM   #5
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
'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.
 
Old 03-27-2014, 03:04 PM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,476
Blog Entries: 10

Rep: Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639
Quote:
Originally Posted by redhatwannabe View Post
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.

Last edited by rtmistler; 03-27-2014 at 03:05 PM.
 
Old 03-27-2014, 03:36 PM   #7
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,506
Blog Entries: 1

Rep: Reputation: 489Reputation: 489Reputation: 489Reputation: 489Reputation: 489
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.
 
Old 03-27-2014, 03:42 PM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,476
Blog Entries: 10

Rep: Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639Reputation: 1639
Quote:
Originally Posted by Shadow_7 View Post
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.
 
  


Reply

Tags
suse11


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Got rid of MS on my laptop, now can't get command lines or load Linux Patrick Duecy Linux - Newbie 5 01-27-2013 08:17 PM
Strange Icons present, cant get rid of them and other things kraihavok Linux - Newbie 1 11-21-2012 06:21 PM
What does the startx command due? kenholtmeyer Linux - Newbie 3 08-21-2011 12:45 AM
[SOLVED] get rid of '/' in the ls -d */ command casualzone Linux - Newbie 2 08-07-2011 10:10 PM
eMail Blocked due to Reverse DNS Issue VorlonInfoTech Linux - Networking 4 06-23-2004 05:23 PM


All times are GMT -5. The time now is 08:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration