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

  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format
  • Using Cisco CME Router with Asterisk as a dial-peer
  • Cisco CME How To Configure SIP Trunk VOIP
  • Virtualbox host Only Network Error Failed to save host network interface parameter - Cannot change gateway IP of host only network
  • Cisco CME and C7200 Router Testing and Learning Environment on Ubuntu 20+ Setup Tutorial Guide
  • Abusive IP ranges blacklist