R1soft Disk Safe Locations and Names script

This week I had to pull data from 24 drives into a new instance of R1Soft Enterprise.  This is practical believe it or not – even with the rediculous Disk Safe names it allocates. This came to pass because a Dell R430 unit acting as a header unit via an H800 for a group of MD1200 chassis has a bad day in the office, slips an disk, which was meant to be in a RAID1. Other drive unreadable. Onboard S130 Software RAID motherboard controller is a hunk of junk. Seriously what is it about 4xx series Power Edge servers – they are a liability compared to 3 or 5 … what on earth is a software raid (OS drivers required) card doing in there?!!

I had written a script before (I am v poor at these things – so feel free to refine) to pull the disk safe names, however – the disk safe names are not always the same as the directories within which they live.

When you have 24 drives of disk safe’s down, your ass is in the breeze and you already have people asking for recovery points… this becomes a ball ache exceptionally quickly.

So… this saved me a whole WORLD of pain – and strangely – as far as I can tell – they have no tools to allow you to do this….

#!/bin/bash

#
# AMH Thursday 18th January 2017
#
# Requires JQ to be installed. Assumes your DISK SAFE’s live off of Media mounts.
#

echo
echo

for burt in `ls /media`
  do
  cd /media/$burt
  echo
  echo “########## $burt ############”
  echo
  df -h | grep $burt$ | awk ‘{ print “Mount “$1 ” // Used “$2 ” // Free “$3” }’
  echo

  for foo in `ls `;
    do
    echo “/media/$burt/$foo”
    cat $foo/metadata2/DiskSafeMetaData | jq -r ‘.[0]’ | jq -r .uuid
    cat $foo/metadata2/DiskSafeMetaData | jq -r ‘.[0]’ | jq -r .lastKnownDiskSafeName
    cat $foo/metadata2/DiskSafeMetaData | jq -r ‘.[0]’ | jq -r .lastAssociatedAgentDescription
    cat $foo/metadata2/DiskSafeMetaData | jq -r ‘.[0]’ | jq -r .lastAssociatedAgentHostName
    du -sh $foo | awk ‘{ print $1 }’
    echo
  done
  echo
done

The output for this looks a little like this:

 

############## sas_nine ###############
Mount /dev/sdq1 // Used 3.7T // Free 1.2T
/media/sas_nine/376bfa34-ab25-4476-ad77-376bfa34
376bfa34-ab25-4476-ad77-afc2b3a7f2fc
plesk1.domain.org
plesk1.domain.org
33.33.33.33
857G
/media/sas_nine/4cd9ed9jkl47-ea15-413a-86a8-4cd9ed9jkl47
4cd9ed9jkl47-ea15-413a-86a8-4cd9ed9jkl47
plesk2.domain.org
plesk2.domain.org
22.22.22.22
366G

…you get a general idea from that

Be sure to change the directory in bold to the mount mounts for your storage array/s, make sure it can find JQ, mark it as executable and off you go.

The top line there is the path from the drive, the second is the disk safe name from the drive,  and the others are simply pulled from the metadata titles – so Disk safe name, Disk safe description, Disk safe hostname. Oh and size… anything over a terabyte and it hesitates a bit.

Audit where your stuff is – rebalance as appropriate, and off you go with re adding them. This is reasonably painless:

 – Click “Setup”;

 – Click “Disk Safes”

 – Click “Attach existing disk safe”

 – Tick ”Import Protected Machine from Disk Safe”;

 – Copy paste disk safe name;

 – Copy paste path;

….next! On completion proceed directly to tea and medals.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this:
Skip to toolbar