Re: Best place to spin down disk after boot?

From: Stefan A. Deutscher (sa.deutscher_at_tiscali.de)
Date: 06/18/04

  • Next message: Gerard Samuel: "Re: Means of traversing a directory"
    Date: Thu, 17 Jun 2004 22:09:59 +0000
    To: freebsd-questions@freebsd.org
    
    

    On Mon, Jun 14, 2004 at 12:37:22AM +0000, Stefan A. Deutscher wrote:
    >
    > Hi, I have a 5.1Release machine with currently four SCSI disks, out of
    > which I need only two at any given time (system and /home). The other
    > ones are an alternative system disk, and an OS/2 disk.

    [ snip ]

    > To reduce noise and heat production, I am going to spin down two SCSI
    > disks on one of my machines with
    >
    > camcontrol stop -n da -u 0
    > camcontrol stop -n da -u 2
    >

    [ snip ]

    > To spin down the disks right after boot, I ponder sticking things
    > either in the /etc/rc.local (seems to be going out of style though) or
    > as a separate script in /etc/rc.d/. Any thoughts on that would be
    > appreciated. As these commands take a while to return with a success
    > message I'd like to do that in the background, and I wish to log it
    > somewhere. Is there 'the right' way to send the camcontrol messages to
    > syslog or the dmesg file (all true believers shall open their egg at
    > the right end!)?

    Following up to myself, I cooked the following script to be placed in
    /etc/rc.d/, it works fine and does what I want it to do. Maybe it helps
    someone else to save time to accomplish the same thing.
    Now I just wonder whether it would be more elegant to place a script
    that does the actual work in /usr/local/bin and just launch that one
    from a small script in /etc/rc.d/. I suppose it's a matter of taste.
    Oh - does stuff like this merit submission to ports?

    [ --- cut here --- ]
    #!/bin/sh
    #
    # Script to spin down unneeded SCSI disks right after system start
    # and log this in the system log (which should be up by then) using
    # /usr/bin/logger (the partition holding it should be mounted by then):

    # PROVIDE: spindown_disks
    # REQUIRE: mountall mountd syslogd
    # KEYWORD: FreeBSD

    LOGGER="/usr/bin/logger -s -t camcontrol"

    PROGNAME=`basename $0`

    case "$1" in
    start|faststart)

         ${LOGGER} Spinning down SCSI disks not needed ...
         ( /sbin/camcontrol stop -n da -u 0 > /dev/null && \
            ${LOGGER} da0 stopped successfully. ) \
         || ${LOGGER} da0 could not be stopped

         ( /sbin/camcontrol stop -n da -u 2 > /dev/null && \
            ${LOGGER} da2 stopped successfully. ) \
         || ${LOGGER} da2 could not be stopped
         ;;
        
    stop)
         ;;

    *)
         echo "${PROGNAME}: unknown option '$1' - should be 'start', 'faststart' or 'stop'" >&2
         ;;
    esac

    # eof.
    [ --- cut here --- ]

    Cheers, Stefan

    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Gerard Samuel: "Re: Means of traversing a directory"

    Relevant Pages

    • Re: Removable Drive Letter Mapping
      ... You could try the script below. ... Modify Line 8 to reflect the number of flash disks you wish to monitor. ... Connect one of your USB drives and watch what happens. ...
      (microsoft.public.windowsxp.general)
    • SUMMARY: storage array error notifications
      ... thanks to Tom Jones for sending me the script he uses to monitor ... I monitor my 3510s as part of my system monitoring scripts. ... Here's a portion from my script, using sccli commands: ... sccli> show disks ...
      (SunManagers)
    • 8.0-RC1 ZFS-root installscript
      ... FreeBSD zfs-root installation, feel free to test ... This script will install FreeBSD onto a GPT based ZFS-root from the ... this script will remove any data on the disks you use! ...
      (freebsd-stable)
    • Re: GEOM_FOX woes
      ... The setup ... >labels on the disks, according to the script in the announce message: ...
      (freebsd-current)
    • Re: Writing 23FDs
      ... and the previous owner devised a complicated song-and-dance act ... I worked on large systems, not the medium-size ones, and even on the large ones I never had both floppies go bad at the same time so I never tried it. ... the 3830 disks could be interchanged if the features and non-microcode EC levels on the boxes were the same. ...
      (bit.listserv.ibm-main)