Jump to content

Ubuntu 12.04 Hot Plug SATA Safe removal


NAS

Recommended Posts

I have been scowering the internet trying to work out how to remotely via ssh safely remove a hot plug sata drive on Ubuntu 12.04 desktop

 

I know how to replicate unity mouting via SSH (udisks) and I know how to safely remove via ssh (sync, udisks, sg_start, cat to device in sys)  but it seems Unity (gvfs) auto detects the drive just after i do all this and makes it "less" safe to remove again.

 

Has anyone any experience/tips on how to deal with hot plug in Ubuntu 12.04

 

Cheers

 

Commands used in the process

 

#Detecting drive
blkid

#Mounting
udisks --mount /dev/sdc1

#Removing
sync
udisks --unmount /dev/sdc1
sg_start /dev/sdc --stop
echo 1 > /sys/block/sdc/device/delete

#Needs
sd-utils

 

Errors seen after i remove the drive include:

 

[39591.460304] ata2.00: disabled
[39605.572436] ata2: exception Emask 0x50 SAct 0x0 SErr 0x4090800 action 0xe fro                                               zen
[39605.572441] ata2: irq_stat 0x00400040, connection status changed
[39605.572445] ata2: SError: { HostInt PHYRdyChg 10B8B DevExch }
[39605.572453] ata2: hard resetting link
[39606.293054] ata2: SATA link down (SStatus 0 SControl 300)
[39606.309045] ata2: EH complete

 

 

Link to comment

OK so this method whilst showing some errors seems to have no negative effects. it is also better than just umounting and pulling a disk whilst it is till spinning.

 

I am sure there is a proper way out there somewhere but it is beyond me to find it.

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...