USB drive changing from SDA to SDB then back

Issues related to hardware problems
Post Reply
jjrowan
Posts: 132
Joined: 2005/09/10 13:07:15
Contact:

USB drive changing from SDA to SDB then back

Post by jjrowan » 2019/01/29 15:32:54

I have an HP Proliant server running CentOS. I installed a 2TB external drive to the USB port to rsync files onto it for for backup. It was working great for 5 months but recently the backup failed. It had been recognized as /dev/sda and the partition was sda1. When the backup failed I found the it was now identified as /dev/sdb. The server hadn't rebooted, no hardware changes. It's at a remote location 600 miles away so visually inspecting isn't an option. I changed the mount from /dev/sda1 to /dev/sdb1 and backups ran for a week. They failed last night. Checking the USB attached drive it's now back to /dev/sda. The USB disk was purchased new in August, Segate disk. I've reformatted disk and created the partition but it doesn't sound like the disk is the problem. Any suggestions?

stevemowbray
Posts: 519
Joined: 2012/06/26 14:20:47

Re: USB drive changing from SDA to SDB then back

Post by stevemowbray » 2019/01/29 15:54:33

Mount using the partition UUID or label, not the device.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: USB drive changing from SDA to SDB then back

Post by TrevorH » 2019/01/29 15:55:33

Device names are ephemeral and you cannot rely on them. Use the UUID or LABEL as suggested.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

jjrowan
Posts: 132
Joined: 2005/09/10 13:07:15
Contact:

Re: USB drive changing from SDA to SDB then back

Post by jjrowan » 2019/01/29 23:10:20

I tried using something google search suggested, it mounted but when backup ran sda1 changed to sdb1 and terminated the backup.
Can someone tell me what I did wrong with the command line below:

mount UUID=$(blkid /dev/sda1 -s UUID -ovalue) /mnt/backup

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: USB drive changing from SDA to SDB then back

Post by MartinR » 2019/01/29 23:28:46

You are taking /dev/sda1, getting its UUID and mounting that. But since you can't rely on /dev/sda1 not changing to /dev/sdb1 there's no guarantee that you are getting the UUID for the right partition. You need to determine the label of UUID from the right partition and then mount that explicitly. For instance if /mnt/backup has /dev/ttc1 mounted on it, and that is the correct partition, then do:

Code: Select all

# blkid dev/sdc1 -s UUID -ovalue
b6881c41-2a83-46cc-b26c-cae23ca988d9
then subsequently perform:

Code: Select all

mount UUID=b6881c41-2a83-46cc-b26c-cae23ca988d9 /mnt/backup
when required.

jjrowan
Posts: 132
Joined: 2005/09/10 13:07:15
Contact:

Re: USB drive changing from SDA to SDB then back

Post by jjrowan » 2019/01/30 22:25:10

I ran blkid, obtained the number and used the mount command with it.
The df command still showed it as being mounted as /dev/sdb1
The volume mounted in /mnt/backup, I was able to write to it for a while but it switched back to sda and the backup failed.
Attachments
blkid.jpg
blkid.jpg (90.43 KiB) Viewed 3643 times

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: USB drive changing from SDA to SDB then back

Post by MartinR » 2019/01/30 22:44:10

Just a thought - check the USB cable and ports. It sounds as if the drive is going offline and when it comes back is being mapped elsewhere. Purely a guess though.

jjrowan
Posts: 132
Joined: 2005/09/10 13:07:15
Contact:

Re: USB drive changing from SDA to SDB then back

Post by jjrowan » 2019/01/30 23:09:19

I'd love to check the cable and ports but the device is 600 miles to the South, the people there don't know how to find the start icon in Windows when you tell them to go to Start. I've tried walking then through troubleshooting but it's beyond their capabilities.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: USB drive changing from SDA to SDB then back

Post by TrevorH » 2019/01/31 00:43:28

USB errors will be logged in /var/log/messages. As will disk attach/detach events.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply