Linux – Refresh /dev/sdx list

devicehard drivekernellinux

I've been messing around with my storage array (in that case 2xMD3000 SAS) and between the scans/rescans/delete/add my /dev/sdx block devices are all messed up.
Some of them are non existent and using fdisk on them gives:

fdisk: unable to open sdc: No such device or address

It's not a real problem as I'm using /dev/disk/by-id/wwn-xxxxx anyway, but I would like to know if there is a way to trigger the kernel into updating/removing those empty and broken devices somehow.
Thanks

Best Answer

Use the command:

rescan-scsi-bus.sh --remove --issue-lip

to have this nice and tidy script handle the work for you.