diff options
author | Bart Van Assche <bvanassche@google.com> | 2022-11-23 20:04:46 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-11-23 20:04:46 +0000 |
commit | 62b99c09a4bbb75fea6c309c77ebf856323d908c (patch) | |
tree | 207cdb23f8257e270a30143fde23d2033901581f /README.sg_start | |
parent | 8718296061e35ba33bf88847e7498f3d7e38f8f1 (diff) | |
parent | 3c61bd9e26bf930f865e28e7eef48856653d1c98 (diff) | |
download | sg3_utils-62b99c09a4bbb75fea6c309c77ebf856323d908c.tar.gz |
Merge remote-tracking branch 'aosp/upstream-main' into HEAD am: 448b67b18a am: d39ef90544 am: 3c61bd9e26
Original change: https://android-review.googlesource.com/c/platform/external/sg3_utils/+/2312210
Change-Id: I0362cffa263ba632a3e2058f8f50f32e024b2cc3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'README.sg_start')
-rw-r--r-- | README.sg_start | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/README.sg_start b/README.sg_start new file mode 100644 index 00000000..22034d4b --- /dev/null +++ b/README.sg_start @@ -0,0 +1,38 @@ +Hi, + +you can use sg_start to start (spin-up, 1) and stop (spin-down, 0) devices. +I also offers a parameter (-s) to send a synchronize cache command to a +device, so it should write back its internal buffers to the medium. + +Be aware that the Linux SCSI subsystem at this time does not automatically +starts stopped devices, so stopping a device which is in use may have fatal +results for you. + +So, you should apply with care. +I use it in my shutdown script at the end (before the poweroff command): + +# SG_SHUG_NOS is set in my config file rc.config +# SG_SHUT_NOS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" +if test -x /bin/sg_start; then + if test "`basename $command`" = "reboot"; then + for no in $SG_SHUT_NOS; + do /bin/sg_start /dev/sg$no -s >/dev/null 2>&1; + done + else + for no in $SG_SHUT_NOS; + do /bin/sg_start /dev/sg$no -s 0 >/dev/null 2>&1; + done + fi +fi + +Enjoy! +Kurt Garloff + + +Postscript +========== +sg_start has been reworked to allow a block device (e.g. /dev/sda) in +addition to the sg device name (e.g. /dev/sg0) in the lk 2.6 series. +sg_start now has more command line options, see its man page. + + Douglas Gilbert <dgilbert at interlog dot com> 2004/5/8 |