Replace /dev/sda with /dev/sdb device name assignment


/ Published in: Bash
Save to your folder(s)

this can obviously be easily adapted to any other device names. Some commands in here are redundant but all together are more likely to work.


Copy this code and paste it in your HTML
  1. (make sure both devices are unmounted)
  2. # cat /proc/partitions
  3. # cd /dev
  4. # rm sda,sdb
  5. # mknod /dev/sda b # fill with major and minor devices obtained from /proc/partitions for sdb
  6. # mknod /dev/sdb b 8 0 # verify these major, minor values for sda in /proc/partitions
  7. # partprobe /dev/sda
  8. # hdparm -z /dev/sda
  9. # sfdisk -R /dev/sda
  10. # blockdev --rereadpt /dev/sda
  11. (repeat the last 4 commands for sdb)
  12.  
  13. Alternatively and to make it permanent:
  14. create the file /etc/udev/rules.d/10-local.rules with the following content:
  15. KERNEL=="sda", NAME="sdb"
  16. KERNEL=="sdb", NAME="sda"
  17.  
  18. (end of file)
  19.  
  20. and then:
  21. # service udev restart
  22. # udevadm control --reload-rules
  23. # udevadm trigger

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.