Linux Tipps und Tricks

From Lolly's Wiki
Revision as of 17:05, 1 March 2016 by Lollypop (talk | contribs)
Jump to navigationJump to search

Tipps und Tricks

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:

  1. mount
  2. pvs
  3. zpool status
  4. 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