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

  • How To Upgrade Debian 8,9,10 to Debian 12 Bookworm
  • Linux dhcp dhclient Mint Redhat Ubuntu Debian How To Use Local Domain DNS Server Instead of ISPs
  • Docker dockerd swarm high CPU usage cause solution
  • Docker Minimum Requirements/How Efficient is Docker? How Much Memory Does Dockerd Use?
  • qemu-nbd: Failed to set NBD socket solution qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
  • apache2 httpd apache server will not start [pid 22449:tid 139972160445760] AH00052: child pid 23248 exit signal Aborted (6) solution Mint Debian Ubuntu Redhat
  • How to use the FTDI USB serial cable to RJ45 adapter to connect to the console on Cisco/Juniper Switch Router Firewall in Linux Ubuntu Debian Redhat
  • How To Setup Python3 in Ubuntu Docker Image for AI Deep Learning
  • How to Configure NVIDIA GPUs with Docker on Ubuntu: A Comprehensive Guide for AI Deep Learning CUDA Solution
  • Linux Ubuntu Mint how to check nameservers when /etc/resolv.conf disabled solution
  • Docker cannot work on other overlayfs filesystems such as ecryptfs won't start overlayfs: filesystem on '/home/docker/overlay2/check-overlayfs-support130645871/upper' not supported as upperdir
  • Linux How To Access Original Contents of Directory Mounted Debian Mint CentOS Redhat Solution
  • ecryptfs how to manually encrypt your existing home directory or other directory
  • How to Reset CIPC Cisco IP Communicator for CME CUCM CallManager
  • Internet Explorer Cannot Download File "Your security settings do not allow for this file to be downloaded." Security Settings Solution
  • Linux How To Upgrade To The Latest Kernel Debian Mint Ubuntu
  • Firefox how to restore and backup saved passwords and history which files/location
  • Linux How To echo as root solution to use tee permission denied solution Ubuntu Debian Mint Redhat CentOS
  • Linux how to keep command line bash process running if you are disconnected or need to logout of SSH remotely
  • Linux swapping too much? How to check the swappiness and stop swapping