Not sure if this is hardware or software related but am posting here in the hopes that someone might point me in the right direction.

Hardware purpose: Home NAS and KVM host.

OS: Ubuntu server 14.04 installed on internal SSD.

Internal Raid: 4 x 2TB 3.5" HDD in mdadm software raid 5 formatted ext4.

Server also contains a PCI-Express USB3.0 card, to which an portable USB2.0 drive is connected for cron-driven backup of valuable data. Server has been running fine for 3 years in this configuration, never broke sweat.

Recent change: portable USB2.0 drive replaced by a portable USB3.0 drive - Seagate Backup Plus Slim 2TB formatted ntfs. This drive performs without fault when connected to a workstation, and if plugged into the USB3.0 card on the server after boot it can be manually mounted and accessed.

Problem: At boot, all drives are recognized by BIOS. O/S boots from internal SSD but hangs after GRUB boot, stating that the internal RAID at /mnt/raidmount (my mountpoint) could not be initialized.

dmesg | tail reveals a bad superblock error on /dev/md0. However, when the external USB3.0 HDD drive is disconnected and the server rebooted, all comes up perfectly, mdadm loads the raid and I can access all data on it without issue. This suggests to me that there is no problem with the RAID, but for some reason it's not presenting itself properly to the OS when the USB3.0 drive is connected.

Thinking this could be an issue with insufficient power supply to the raid array (USB3.0 draws more power than USB2.0) I upgraded the PSU from 300W to 450W, but the problem persists.

I've found no examples of this through Google, and am stuck as to what to try next. I plan to eventually upgrade the server OS to 16.04 and replace the ext4 raid with a ZFS filesystem for better error correction, but unless I can confidently back up the contents of the RAID to the external HDD, I'm unable to proceed.


I found the answer to my own question. My problem was caused by two things:

1. Ubuntu changing drive letter assignment at boot when USB drive plugged in

Without the USB drive plugged in, Ubuntu assigned the disks in my system as follows:

/dev/sda : RAID disk 1
/dev/sdb : RAID disk 2
/dev/sdc : RAID disk 3
/dev/sdd : RAID disk 4
/dev/sde : Operating System disk

With the USB drive plugged in at boot, Ubuntu assigned the disks as follows:

/dev/sda : USB connected drive
/dev/sdb : RAID disk 1
/dev/sdc : RAID disk 2
/dev/sdd : RAID disk 3
/dev/sde : RAID disk 4
/dev/sdf : Operating System disk

2. mdadm.conf specifically referencing drive letters

My mdadm.conf file at /etc/mdadm/mdadm.conf had the following entry:

DEVICE /dev/sd[abcd]

This was forcing mdadm to use the first four drive letters to pull together the RAID array during boot, which failed when the USB drive was plugged in because /dev/sda1 was allocated to the USB drive rather than the first drive in the RAID array. Because mdadm uses the superblocks on each disk to store the RAID array membership information, telling mdadm which drives to use isn't usually necessary - mdadm will just go out and look at all available drives and pull the RAID together all on its own.

Instead, my mdadm.conf file should have included the line:

DEVICE partitions

Which tells mdadm to scan all partitions on all drives for the superblocks it uses to identify the RAID members. This is more robust, allowing Ubuntu to assign drive letters as it sees fit and leaving mdadm to do its job of pulling the RAID together uninhibited.

Making this simple change made the problem go away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.