Linux Tipps und Tricks: Difference between revisions
From Lolly's Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
For more look at [https://www.kernel.org/doc/Documentation/sysrq.txt kernel.org]! | For more look at [https://www.kernel.org/doc/Documentation/sysrq.txt kernel.org]! | ||
==Scan all SCSI buses for new devices== | |||
<source lang=bash> | |||
# for i in /sys/class/scsi_host/host*/scan ; do echo "- - -" > $i ; done | |||
</source> | |||
==Remove a SCSI-device== | |||
Let us say we want to remove /dev/sdb. | |||
Be careful! Like in this example the lowest SCSI-ID is not always the lowest device name! | |||
Check it with <i>lsscsi</i> from the Ubuntu package lsscsi: | |||
<source lang=bash> | |||
# lsscsi | |||
[2:0:0:0] cd/dvd NECVMWar VMware SATA CD00 1.00 /dev/sr0 | |||
[32:0:0:0] disk VMware Virtual disk 1.0 /dev/sdb | |||
[32:0:1:0] disk VMware Virtual disk 1.0 /dev/sda | |||
</source> | |||
Then check it is not longer in use: | |||
# mount | |||
# pvs | |||
# zpool status | |||
# etc. | |||
Then delete it: | |||
<source lang=bash> | |||
# echo 1 > /sys/bus/scsi/drivers/sd/32\:0\:0\:0/delete | |||
</source> | |||
The 32:0:0:0 is the number reported from the lsscsi above. | |||
Et voila: | |||
<source lang=bash> | |||
# lsscsi | |||
[2:0:0:0] cd/dvd NECVMWar VMware SATA CD00 1.00 /dev/sr0 | |||
[32:0:1:0] disk VMware Virtual disk 1.0 /dev/sda | |||
</source> |
Revision as of 17:05, 1 March 2016
Hard reboot
This is the hard way to kick your kernel into void. No filesystem sync is done, just an ugly fast direkt reboot! You should never do this...
# echo 1 > /proc/sys/kernel/sysrq
# echo b > /proc/sysrq-trigger
First line enables sysrq, second line sends the reboot request.
For more look at kernel.org!
Scan all SCSI buses for new devices
# for i in /sys/class/scsi_host/host*/scan ; do echo "- - -" > $i ; done
Remove a SCSI-device
Let us say we want to remove /dev/sdb.
Be careful! Like in this example the lowest SCSI-ID is not always the lowest device name! Check it with lsscsi from the Ubuntu package lsscsi:
# lsscsi
[2:0:0:0] cd/dvd NECVMWar VMware SATA CD00 1.00 /dev/sr0
[32:0:0:0] disk VMware Virtual disk 1.0 /dev/sdb
[32:0:1:0] disk VMware Virtual disk 1.0 /dev/sda
Then check it is not longer in use:
- mount
- pvs
- zpool status
- etc.
Then delete it:
# echo 1 > /sys/bus/scsi/drivers/sd/32\:0\:0\:0/delete
The 32:0:0:0 is the number reported from the lsscsi above.
Et voila:
# lsscsi
[2:0:0:0] cd/dvd NECVMWar VMware SATA CD00 1.00 /dev/sr0
[32:0:1:0] disk VMware Virtual disk 1.0 /dev/sda