0

I have a cloud server, where a block device (/dev/xvdb1 with filesystem ext3) is attached .

I want to create a persistent symlink (/dev/test_link) which should always target to (/dev/xvdb1) using udev rules.

OS -> 16.04 ubuntu

  • 1
    Welcome to Unix & Linux. ;-) What are you trying to accomplish here? Do you want to auto-mount the device to /dev/test_link because the description of what you're trying to accomplish looks like an XY problem – Fabby Dec 16 '18 at 11:10
  • Actually, I want to create a symlink under /dev using udev, persistently. the persistant symlink (/dev/test_link) should target the block device (/dev/xvdb1) which is on my LinuxAcademy cloud server which has ext3 filesystem. – Imrank Dec 16 '18 at 12:23
  • That's a repeat of your request. The question is: What are you trying to accomplish here: Learn about udev or trying to accomplish a task? – Fabby Dec 16 '18 at 13:31
  • im trying to accomplish a task. – Imrank Dec 16 '18 at 13:37
  • Please help us help you: edit your question and provide more details as it's hard to guess which task you're trying to accomplish. For now, your question is unclear what you're trying to accomplish. ;-) – Fabby Dec 16 '18 at 14:27
1

You should start with using udevadm monitor when attaching your target device, or udevadm info --name=/dev/xvdb1 --attribute-walk, when already attached, to have a look at how udev sees your device. Than you can create udev rules which match only the special device. Also blkid would be a good starter, where you can see the ID of your device, for which you can than create udev rules. (Examples for rules can e.g. be found at https://wiki.debian.org/udev )

  • Hello, thanks for your response. I have created the symlink and I think its kinda work, could you please check my work? link: pastebin.com/JLL57dZx – Imrank Dec 16 '18 at 18:18
  • I will not go through it completely, but one hint: the kernel may not always recognize the device as xvdb1. Depending on your attached devices it may e.g. be something like xvda1 or xvdc1 on another day of rebooting. Maybe udevadm info dev/xvdb1 or udevadm info dev/xvdb will get you more/better possibilities to always pinpoint the correct device. There are many udev examples and beginner's guides out there to help you further :-) – Jaleks Dec 17 '18 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.