| View previous topic :: View next topic |
| Author |
Message |
indijanc
Joined: Wed Apr 04, 2012 3:49 pm Posts: 2
|
Posted: Wed Apr 04, 2012 4:03 pm Post subject: /dev/disk/by-id cleanup |
|
|
Is there any way to clean up stale devices/symlinks in the /dev/disk/by-id folder?
I have a SLES 11.1 with a SAN connected disk array. I'm using a program for disk replication and presenting the disks to the server. The program also enables the disks and creates a volume group on top. When it finishes it cleans up after itself (remove vg, unpresent etc.). After a few days of running it, the /dev/disk/by-id folder holds a large number of files (mostly softlinks to lvm devices). Is there any way to clean/remove these? So far only reboot helps  |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 7993 Location: Warrington, UK
|
Posted: Thu Apr 05, 2012 1:54 am Post subject: |
|
|
Do you mean that the directory is full of links that point nowhere? If so, this command will remove them.
| Code: | | find -L /dev/disk/by-id -type l -exec rm "{}" + |
The -L options makes find follow symbolic links and use information fro the file linked to rather than the link itself, so the only links it sees as links (-type l) are broken ones (or links that point to an unreadable file, but that won't happen if you run this as root). _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
indijanc
Joined: Wed Apr 04, 2012 3:49 pm Posts: 2
|
Posted: Thu Apr 05, 2012 8:42 am Post subject: |
|
|
Thank you nelz, that does clean up the stale links.
I'd rather use a udev cleanup command or something similar though, since udev creates these links and takes care of them if I'm not mistaken. Is there any udev (or something similar) cleanup mode/command to take care of this? So far I haven't found any clues on "proper" removal of these stale softlinks.
Thanks for the help  |
|
| Back to top |
|
 |
ferrari
Joined: Tue May 03, 2005 12:09 pm Posts: 97
|
Posted: Tue Apr 10, 2012 4:41 am Post subject: |
|
|
| I'm surprised you had stale links, because AFAIU, udev creates/deletes these dynamically (via kernel uevents) as any disks are detected or removed, but maybe your disk replication app is responsible for this behaviour? |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|