Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 37

Thread: Proper way to plug/unplug an eSATA hard disk?

  1. #21
    Join Date
    Jul 2009
    Posts
    351

    Default Power down first!

    My experience with hot-plugging is that nearby drives will suffer data loss from power surges unless you power down the drive before unplugging it.

    Proper RAID cages have individual power switches for the drives.

  2. #22
    Join Date
    Apr 2008
    Posts
    4

    Default software and hardware

    I think there's a difference between hardware capabilities and software capabilities. SATA hardware is hot plug-able. The software being used may need (probably does) a different consideration.

  3. #23
    Join Date
    Apr 2010
    Posts
    1,946

    Default

    Quote Originally Posted by frantaylor View Post
    My experience with hot-plugging is that nearby drives will suffer data loss from power surges unless you power down the drive before unplugging it.

    Proper RAID cages have individual power switches for the drives.
    I have addressed that in my post already.
    ALL SATA power interfaces CAN powerdown properly! They are designed for this task!

    However the normal SATA cables - not. And chipset should understand the logic. And lastly, operating system should force the drive to write the cache before unplugging and disable the access(this happens when you umount - it calls sync and removes node).

    Use esata cable or hot-plug cage + with chipset supporting hotswapping + disable write cache or block physical access + umount before you plug it off.

    SCSI and IDE are completely different cases!

  4. #24
    Join Date
    Aug 2008
    Posts
    71

    Default My Backup script

    Very interesting thread. This has been a question of mine for some time, since I recently wrote a small script (be easy on me, this is my first script I wrote in linux) that would automate my backups some more.

    I use 3x 2TB WD Green drives as my backup drives, used in a one hard drive at a time rotation. I also use a Thermaltake Hot Swap bay, which has the necessary cable configuration (I believe it actually disconnects the data cable first, and then the power. The ground being the last connection to sever. Don't quote me on this though)

    I also use the SimpleBackup program to do the actual backing up of the files I want. I know it's not the most sophisticated, but it does the job I need it to do, and it is ... well, simple.

    Here is the script I run to mount the hard drives. I run this 1 hour before the backup process starts. Also, note that I named the drives 'Backup HDD I', 'Backup HDD II', 'Backup HDD III', so the script looks for the 'Backup HDD' part to identify which drive to mount to '/media/Backups'.

    Code:
    #!/bin/bash
    
    logfile=/home/gtrawoger/BackupDriveMount.log
    seperator=------------------------------------
    
    #partprobe                                               # Commented out since it didn't make the system more stable, as intended
    
    list=$(blkid | grep 'Backup HDD')                       # Search for 'Backup HDD' string in the listing of drives via the 'blkid' command
    today=$(date)                                           # Today's date for the logfile
    
    drive=${list:0:9}                                       # Extract the substring of the drive from the 'list' string
    
    location=$(expr index "$list" LABEL=)                   # Start of procedure for finding the drivelabel. 'location' gets filled with the string location of 'LABEL='
    location=$[$location+6]                                 # Add 6 to location so that we are at the beginning of the disklabel string
    temp=${list:$location}                                  # Fill a temporary variable with the rest of the string, beginning with the disklabel.
    location=$(expr index "$temp" '"')                      # To remove the rest of the string away from the disklabel, find the next occurence of a quote
    location=$[$location-1]                                 # Take one step back from there, and we know where the disklabel ends.
    
    disklabel=${temp:0:$location}                           # Set the disklabel by extracting the substring for it.
    
    if [ ${#drive} = 9 ]                                    # If the length of the drive string is 9 (i.e. '/dev/sdc1' = 9) then the string is filled, otherwise it was not found
            then
    
               echo $seperator >> $logfile
               echo $today >> $logfile
               echo $drive >> $logfile
               echo $disklabel >> $logfile
              
               umount $drive                                # In case the drive got mounted some other way, try unmounting it that way. May produce error message.
               e2fsck -p -f -C 0 $drive                     # Check the filesystem before mounting. This was added because of a suspicion that if the filesystem is corrupt, the computer hard locks.
               mount $drive /media/Backups >> $logfile
    
               rm -r /media/Backups/Backups/                # Remove Old Backups - only one, current backup needed
               mkdir /media/Backups/Backups                 # Previous Command removes the Backup directory too. This recreates it.
    
    
            else
    
               echo $seperator >> $logfile
               echo $today >> $logfile
               echo Drive not Found! >> $logfile
    
       
         fi
    SimpleBackup looks for the 'Backups' directory under the '/media/Backups', and if it doesn't find it (no hard drive found) it stops the backup process and sends an email to me.

    Now the reason this thread was interesting for me is because I have another script I run that checks to see if the backup process is done and if it is, unmount the drive ahead of time. This way, all I have to do at the end of the day is walk over to the server, pull out the hard drive and put another one in. I then take that hard drive home. This is how I get a daily offside backup of ~1TB of data.

    Here is the unmount script I run at ~15:00. The SimpleBackup process will have both gzip and python running at the same time, so I simply check if they are running. Not the best method, but ok on a server that does nothing else.

    Code:
    #!/bin/bash
    # init
    
    
    if [ "$(pgrep gzip)" ]
    then
            if [ "$(pgrep python)" ]
            then
                      echo "Backup is still running.";
                      exit
            fi
    else
      umount /media/Backups
      exit
    fi
    Is there a better way of doing this? It seems to run fine (no lock ups for weeks). Any suggestions? Do I need to run some of the mentioned commands, such as 'hdparm -Y /dev/sdX' or 'echo 0 - 0 > /sys/class/scsi_host/hostX/scan'???
    Last edited by gtrawoger; 02-24-2012 at 08:51 AM.

  5. #25
    Join Date
    Aug 2008
    Posts
    71

    Default Thermaltake Bay I used

    Just if anybody is interested, this is the bay I used: http://www.newegg.com/Product/Produc...82E16817998032 (Sorry Michael, couldn't figure out how to link this with your ID attached)

  6. #26
    Join Date
    Apr 2010
    Posts
    1,946

    Default

    Quote Originally Posted by gtrawoger View Post
    Just if anybody is interested, this is the bay I used: http://www.newegg.com/Product/Produc...82E16817998032 (Sorry Michael, couldn't figure out how to link this with your ID attached)
    Well, this is pretty much the standard-looking hot-swap drivebay seen in many dell servers.

  7. #27
    Join Date
    Jul 2009
    Posts
    351

    Default

    Quote Originally Posted by crazycheese View Post
    I have addressed that in my post already.
    ALL SATA power interfaces CAN powerdown properly!
    That's not the issue. The issue is that humans cannot plug and unplug connectors without bouncing the contacts. You did NOT address this issue in your post.

  8. #28
    Join Date
    Jan 2009
    Posts
    1,354

    Default

    Quote Originally Posted by frantaylor View Post
    My experience with hot-plugging is that nearby drives will suffer data loss from power surges unless you power down the drive before unplugging it.

    Proper RAID cages have individual power switches for the drives.
    What would you suggest for home use?
    I bought a tower awhile back and had intended to fill it with raided drives, but then found out that to do hotswap you really need hotswap trays, which aren't made for the cmstacker.
    So now I've been looking at http://www.newegg.com/Product/Produc...aidage&x=0&y=0 but reviews are a bit hard to come by. QNAP also apparently makes quite nice ones but again, reviews are a problem.
    I had thought to use software raid since I've heard nothing but bad things about hardware raid, save the never specified high end raid cards.

    Sorry for the thread jacking

  9. #29
    Join Date
    Apr 2010
    Posts
    1,946

    Default

    Quote Originally Posted by frantaylor View Post
    That's not the issue. The issue is that humans cannot plug and unplug connectors without bouncing the contacts. You did NOT address this issue in your post.
    If they are well paid, they sure can. Besides the normal hotswap cage is little bit shaky, their advantage is not within damaging less, but within allowing fast frontal extraction without need to unscrew anything.

  10. #30
    Join Date
    Apr 2010
    Posts
    1,946

    Default

    Quote Originally Posted by liam View Post
    What would you suggest for home use?
    I bought a tower awhile back and had intended to fill it with raided drives, but then found out that to do hotswap you really need hotswap trays, which aren't made for the cmstacker.
    So now I've been looking at http://www.newegg.com/Product/Produc...aidage&x=0&y=0 but reviews are a bit hard to come by. QNAP also apparently makes quite nice ones but again, reviews are a problem.
    I had thought to use software raid since I've heard nothing but bad things about hardware raid, save the never specified high end raid cards.

    Sorry for the thread jacking
    openmediavault, 2xN WD RE4 drives, xeon or opteron, 2-4-8gb ecc ram for 10/40/80 client machines.
    Last edited by crazycheese; 02-25-2012 at 05:57 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •