You are not logged in.

#1 2016-05-31 14:07:09

karthik
New Member
Registered: 2016-05-31
Posts: 4

"safe remove" hard disc

hi, i am still running #! on a stoneage machine. And i am planning to buy an new machine and install bunsenlab. One tiny difficulty i faced on #! was when i inserted an external hard disc, there was no option to "remove disc safely / Safe remove". instead it had just "eject". and when eject was clicked external hardisc would just unmount, but power kept going on in it(light on hardisc kept on) and sometime even there used to be some slight humming(running silently, could feel it through vibration). So i cross checked it with other linux distros like ubuntu and mint. No issues over them.

Now i want to know does bunsen lab has a safely remove option, if so does it takes care to safely cut the power to the external disc by writing stuffs to the disk that has to be written, then unmounts, and then cut the power to the disk. Can any one please check if there is an option and if it does so, does it completely cut the power properly before removing.


Thanks

Offline

#2 2016-05-31 15:36:05

nobody
The Great
Registered: 2015-08-10
Posts: 3,655

Re: "safe remove" hard disc

karthik wrote:

hi, i am still running #! on a stoneage machine. And i am planning to buy an new machine and install bunsenlab. One tiny difficulty i faced on #! was when i inserted an external hard disc, there was no option to "remove disc safely / Safe remove". instead it had just "eject". and when eject was clicked external hardisc would just unmount, but power kept going on in it(light on hardisc kept on) and sometime even there used to be some slight humming(running silently, could feel it through vibration). So i cross checked it with other linux distros like ubuntu and mint. No issues over them.

Now i want to know does bunsen lab has a safely remove option, if so does it takes care to safely cut the power to the external disc by writing stuffs to the disk that has to be written, then unmounts, and then cut the power to the disk. Can any one please check if there is an option and if it does so, does it completely cut the power properly before removing.


Thanks

There is no power cutting of EIDE/SATA/SCSI/USB hard disks using desktop environments. To 'safely' remove an external storage device, you want to ensure two things: that all software I/O transactions are finished or get cancelled, and that the physical disk spins down cleanly before any power is cut by sending the STANDBY IMMEDIATE command (read: plug the USB cable, or cut power) (prevents the infamous Power-Off_Retract_Count from increasing).

Unmounting (probably referred to as 'eject' in some desktop environments or programs) takes care of stopping transactions. (Actually, not really. Just file system transactions. The drive can still be probed. But it's enough for us ATM.)

When no disk access is occurring, the disk probably will spin down by itself after a while (depends on the disk). You can however manually spin down a disk using a special utility: hdparm.

sudo apt-get install hdparm
sudo hdparm -y $path_to_device # -y stands for stand-by

for example

sudo hdparm -y /dev/sdc

I use this all the time on my external hard drives. You can also use hdparm to configure the time until the drive spins down by itself using

hdparm -S

View the man page of hdparm for more details.

Somebody could make a pipemenu for openbox or somehow add a context menu entry to thunar.

Personally, I'm using this as part of an unmount function in my .bashrc:

ztumount () 
{ 
    local DISK=$(findfs UUID=ee3fdf74-xxxx-xxxx-xxxx-3eeea346d3de); # determine the device node of my external hard disk by UUID
    local CRYPTODISK=NietzscheCrypt; # crypto device
    local VGROUP=zarathustra; # volume group
    sudo umount /mnt/$VGROUP-*; # unmount all stuff
    sudo vgchange -an $VGROUP; # close volume group
    sudo cryptsetup luksClose $CRYPTODISK; # close crypto device
    sudo hdparm -y "$DISK" # spin down disk - safe to cut power.
# note: my user doesn't need a password to use sudo.
}

Offline

#3 2016-05-31 17:05:58

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: "safe remove" hard disc

nobody wrote:

When no disk access is occurring, the disk probably will spin down by itself after a while (depends on the disk). You can however manually spin down a disk using a special utility: hdparm.

sudo apt-get install hdparm
sudo hdparm -y $path_to_device # -y stands for stand-by

for example

sudo hdparm -y /dev/sdc

I use this all the time on my external hard drives. You can also use hdparm to configure the time until the drive spins down by itself using

hdparm -S

Very cool!   I'm so ...so tempted to play around with the command:

hdparm --make-bad-sector  

Of course ignoring the big warning message ("DO NOT USE THIS FLAG"  ) about it on the man page  big_smile

Last edited by Horizon_Brave (2016-05-31 17:14:06)


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#4 2016-05-31 18:38:55

karthik
New Member
Registered: 2016-05-31
Posts: 4

Re: "safe remove" hard disc

Thanks nobody for explaining things that happens at the back while removing an external disk. But still adding a button on a right click menu option would be a much more simpler way to remove a disk on a single click. Im not lazy but sometime i am.

nobody wrote:

Somebody could make a pipemenu for openbox or somehow add a context menu entry to thunar.

How could i or some one bring this to thunar teams notice

nobody wrote:

Personally, I'm using this as part of an unmount function in my .bashrc:

ztumount () 
{ 
    local DISK=$(findfs UUID=ee3fdf74-xxxx-xxxx-xxxx-3eeea346d3de); # determine the device node of my external hard disk by UUID
    local CRYPTODISK=NietzscheCrypt; # crypto device
    local VGROUP=zarathustra; # volume group
    sudo umount /mnt/$VGROUP-*; # unmount all stuff
    sudo vgchange -an $VGROUP; # close volume group
    sudo cryptsetup luksClose $CRYPTODISK; # close crypto device
    sudo hdparm -y "$DISK" # spin down disk - safe to cut power.
# note: my user doesn't need a password to use sudo.
}

Thanks for the script and explanation by comments.
say if i connect different disk from time to time.. should add all the UUID in the script

Offline

#5 2016-05-31 18:57:13

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: "safe remove" hard disc

You can add your own context menu item in thunar ( Edit -> Configure custom actions... )

It may be possible to use your script as the command.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#6 2016-05-31 20:33:35

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: "safe remove" hard disc

Yea I was about to say that this seems like something that could be scripted and run with a command, or even tied to a menu button click


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#7 2016-06-01 06:29:39

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: "safe remove" hard disc

isn't thunar taking care of safe unmount?

or maybe i'm missing the pint of this thread.

Offline

#8 2016-06-01 07:17:07

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: "safe remove" hard disc

ohnonot wrote:

or maybe i'm missing the pint of this thread.

Or maybe you had too many pints already? wink

Offline

#9 2016-06-01 13:42:30

karthik
New Member
Registered: 2016-05-31
Posts: 4

Re: "safe remove" hard disc

Some times i had experienced some data not completely written to the disk or not spin down properly.
I would probably end up removing forcefully. I also cross verified with other hard disk's and also over other OS's.
I love the way Thunar's look and feel, it is fast, But i regret to say that i hate that it doesn't handles this one thing properly. And i wonder that no one had ever came across this thing yet.

Last edited by karthik (2016-06-01 13:46:32)

Offline

#10 2016-06-01 14:14:07

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: "safe remove" hard disc

karthik wrote:

And i wonder that no one had ever came across this thing yet

Maybe because corruption does not happen all that often in the real world and can be avoided with a little user cooperation - i.e. don't cut connection to external HD too abruptly.

Even if you find another file manager and another OS that does handle things properly as you say, an abrupt power cut can still cause corruption that possibly gets detected long after the facts.

If your data is so precious to you, then maybe you should rather invest in an UPS, and use mirroring to protect it.

Offline

#11 2016-06-01 15:12:43

karthik
New Member
Registered: 2016-05-31
Posts: 4

Re: "safe remove" hard disc

xaos52,.. im sorry if my English was bad and i did not explained properly..

I had to remove the disk abruptly because, sometimes even after pressing eject button, it kept spinning. Its not about shutting down or UPS.

The point is, haven't any one came across this situation, or why haven't Thunar gave a thought about adding an option to remove external disks safely

Offline

Board footer

Powered by FluxBB