Linux AHCI Hotswap Tips - Remember To Reread The Partition Table WITHOUT rebooting

From the package "parted" you can use the command "partprobe" to re-read the partition table.  I really hate rebooting, and that's what I loved to hear about AHCI motherboards, that they allow hotswap so you don't have to reboot.  But that's only as good as the OS, if the OS does not reload the partition table you won't be able to do anything with that new drive you attached without rebooting.  Yes, even without re-reading the partiton table Linux will detect and show the new device you attached, but it won't work right (eg. you can't even format it) until you reread the partition table.  Most people would probably say "you have to reboot", but with "partprobe" you don't need to.

Otherwise when trying to format/initialize the drive you'll get annoying and strange errors like this:

mdadm --create /dev/md2 --level=1 --raid-devices=2 missing /dev/sdd2
mdadm: device /dev/sdd2 not suitable for any style of array

And just for fun here it is in action, I'm just excited because I didn't know AHCI enabled hotswap on a consumer grade motherboard.  Back in the 90's and early 2000's we could only dream of hotswap with expensive SCSI arrays.

 

ata3: exception Emask 0x10 SAct 0x0 SErr 0x40d0000 action 0xa frozen
ata3: irq_stat 0x00400040, connection status changed
ata3: SError: { PHYRdyChg CommWake 10B8B DevExch }
ata3: soft resetting link
ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata3.00: ATA-8: ST31000333AS, CC1F, max UDMA/133
ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata3.00: configured for UDMA/133
ata3: EH complete
scsi 2:0:0:0: Direct-Access     ATA      ST31000333AS     CC1F PQ: 0 ANSI: 5
sd 2:0:0:0: [sdd] 1953525168 512-byte hardware sectors (1000205 MB)
sd 2:0:0:0: [sdd] Write Protect is off
sd 2:0:0:0: [sdd] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 2:0:0:0: [sdd] 1953525168 512-byte hardware sectors (1000205 MB)
sd 2:0:0:0: [sdd] Write Protect is off
sd 2:0:0:0: [sdd] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sdd: unknown partition table
sd 2:0:0:0: [sdd] Attached SCSI disk
sd 2:0:0:0: Attached scsi generic sg3 type 0

I read somewhere but haven't confirmed that you can manually do the partition re-read like this (supposedly this works even if partprobe doesn't do the job):

echo 1 > /sys/block/sdc/device/rescan

 

 


Tags:

linux, ahci, hotswap, reread, partition, rebootingfrom, quot, parted, partprobe, rebooting, motherboards, reboot, os, reload, partiton, detect, eg, format, initialize, ll, errors, mdadm, dev, md, raid, devices, sdd, suitable, array, didn, enabled, consumer, motherboard, scsi, arrays, ata, exception, emask, sact, serr, xa, irq_stat, serror, phyrdychg, commwake, devexch, resetting, sata, gbps, sstatus, scontrol, cc, udma, sectors, multi, lba, ncq, depth, configured, pq, ansi, byte, hardware, mb, mode, cache, doesn, dpo, fua, disk, generic, sg, haven, manually, echo, sys, sdc, rescan,

Latest Articles

  • Linux Ubuntu Cannot Print Large Images
  • Cannot Print PDF Solution and Howto Resize
  • Linux Console Login Screen TTY Change Message
  • Apache Cannot Start Listening Already on 0.0.0.0
  • MySQL Bash Query to pipe input directly without using heredoc trick
  • CentOS 6 and 7 / RHEL Persistent DHCP Solution
  • Debian Ubuntu Mint rc-local service startup error solution rc-local.service: Failed at step EXEC spawning /etc/rc.local: Exec format error
  • MySQL Cheatsheet Guide and Tutorial
  • bash script kill whois or other command that is running for too long
  • Linux tftp listens on all interfaces and IPs by DEFAULT Security Risk Hole Solution
  • python import docx error
  • Cisco Unified Communications Manager Express Cheatsheet CUCME CME
  • Linux Ubuntu Debian Missing privilege separation directory: /var/run/sshd
  • bash how to count the number of columns or words in a line
  • bash if statement how to test program output without assigning to variable
  • RTNETLINK answers: Network is unreachable
  • Centos 7 how to save iptables rules like Centos 6
  • nfs tuning maximum amount of connections
  • qemu-kvm error "Could not initialize SDL(No available video device) - exiting"
  • Centos 7 tftpd will not work with selinux enabled