Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Finding drive serial by ATA Number

Featured Replies

Hi All,

 

I am having an issue with ATA errors in my syslog.  I haven't solved this issue yet but my immediate issue was finding the drive serial given the ATA number.  The syslog didn't have enough info.  I ended up putting together bits and pieces of info I found and wrote the following script.  Hopefully, this will help someone else in the same situation.
 

#!/bin/bash

# Ask the user for the ATA number to search for
read -p "Enter the disk ATA number to find: " ata 

# Find the device name (e.g., sdd) corresponding to the ATA number
device=$(ls -l /sys/block/sd* | grep $(grep ^$ata$ /sys/class/scsi_host/host*/unique_id | awk -F'/' '{print $5}') | awk -F'/' '{print $NF}')

# Check if a device was found
if [ -z "$device" ]; then
  echo "No device found for ATA number $ata"
  exit 1
fi

# Find the serial number by searching the /dev/disk/by-id directory
serial=$(ls -l /dev/disk/by-id/ | grep "ata-" | grep "../../$device" | awk -F'ata-' '{print $2}' | awk -F' ->' '{print $1}')

# Check if a serial number was found
if [ -z "$serial" ]; then
  echo "No serial number found for device $device"
  exit 1
fi

# Output the device name and serial number
echo "Device: $device"
echo "Serial Number: $serial"

 

It takes the ATA number as input and creates output that looks like this:
 

root@Storm-Tower:~# ./find_disk_by_ata.sh 
Enter the disk ATA number to find: 6
Device: sdf
Serial Number: ST18000NM000J-2TV103_ZR5E11XN
ST18000NM000J-2TV103_ZR5E11XN-part1

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.