General Mac OS X Discussion General Apple and Mac OS X Discussion

Reply
 
LinkBack Thread Tools Display Modes
  (#1) Old
Expert Member
 
Posts: 692
Join Date: Mar 2009
Default I know its there, just not where… - 05-01-2009, 10:36 PM

I'm about to install one of those PCI-e to SDHC reader cards in my mini. Since the mini turns off any USB device when it sleeps that means my internal SDHC 'disk' will be unmounted without the proper OS X 'drag it to the trash' unmount operation.

I'm sure there's at least 1 place to add a script to dismount any SDHC discs before sleep actually occurs. Just not enough of a hacker to know where I want to look.

Help anyone, please?
Brian


Mini1: Vostro A90, Black, 2G, 1.3 Webcam, Bluetooth, 64G SuperTalent, OS X 10.6.4
Mini2: Mini9, Black, 2G, 0.3 Webcam, Bluetooth, 32G RunCore, OS X/Win 7, internal PCI-e SHDC Reader
Mini3: Mini10v. Black, 2G, Webcam, 640G HD, OS X 10.5.8/Win 7/Ubuntu [Hibernate w/NBI 0.8.3 RC4]
Dropbox Referral
Reply With Quote
  (#2) Old
Super Moderator
 
mechdrew's Avatar
 
Posts: 1,356
Join Date: Jan 2009
Location: Idaho
Send a message via AIM to mechdrew
Default Re: I know its there, just not where… - 05-01-2009, 11:39 PM

Um... what? Why on earth are you doing this again? My SDHC card in the SD slot doesn't unmount during sleep. It is exactly where I left it when I open the lid or press the power button. No errors or anything. So I'm having a very hard time figuring out what you are trying to accomplish.


Dell Mini 10v | Mac OS X 10.6.2 | XP Home | Windows 7 Home | 2GB RAM | 160GB HDD | BIOS A05 | USB Legacy: ON | USB Wake: ON | BT: None | NBI 0.8.3 Final
http://osx.mechdrew.com - News and Guides for Installing Mac OS X via NetbookInstaller - Now on Twitter

Reply With Quote
  (#3) Old
Expert Member
 
Posts: 692
Join Date: Mar 2009
Default Re: I know its there, just not where… - 05-02-2009, 12:11 AM

http://mydellmini.com/forum/viewtopic.php?f=11&t=4845

This thread is about a mini PCI-e adapter that takes a SDHC card. This would give an additional SDHC card for use to suppliment the storage on my mini.

*BUT* it shows up as a USB device, ie. a card reader. When sleep happens power turns off card is dismounted but not gracefully. Same as what happens with a USB reader stuck in one of the USB ports. I'm just asking where to stick my script, what location for this sort of thing.

Brian


Mini1: Vostro A90, Black, 2G, 1.3 Webcam, Bluetooth, 64G SuperTalent, OS X 10.6.4
Mini2: Mini9, Black, 2G, 0.3 Webcam, Bluetooth, 32G RunCore, OS X/Win 7, internal PCI-e SHDC Reader
Mini3: Mini10v. Black, 2G, Webcam, 640G HD, OS X 10.5.8/Win 7/Ubuntu [Hibernate w/NBI 0.8.3 RC4]
Dropbox Referral
Reply With Quote
  (#4) Old
Super Moderator
 
mechdrew's Avatar
 
Posts: 1,356
Join Date: Jan 2009
Location: Idaho
Send a message via AIM to mechdrew
Default Re: I know its there, just not where… - 05-02-2009, 01:29 AM

Well, I found this old app that may or may not work for you. I know it is PPC based, but it may still work. I'll keep looking around for a better solution.


Dell Mini 10v | Mac OS X 10.6.2 | XP Home | Windows 7 Home | 2GB RAM | 160GB HDD | BIOS A05 | USB Legacy: ON | USB Wake: ON | BT: None | NBI 0.8.3 Final
http://osx.mechdrew.com - News and Guides for Installing Mac OS X via NetbookInstaller - Now on Twitter

Reply With Quote
  (#5) Old
Expert Member
 
Posts: 692
Join Date: Mar 2009
Default Re: I know its there, just not where… - 05-02-2009, 03:08 AM

That's sort of the idea but that will quit any applications running an app that was on the USB card, nice idea, but I'm looking to dismount the drive.

For example, on my eee 701 I have scripts that get run from /etc/acpi/powerbtn.sh and /etc/acpi/suspend2ram.sh

I'm betting there are similar places for OS X given its *nix roots.

That's what I'm lookin' fer


Mini1: Vostro A90, Black, 2G, 1.3 Webcam, Bluetooth, 64G SuperTalent, OS X 10.6.4
Mini2: Mini9, Black, 2G, 0.3 Webcam, Bluetooth, 32G RunCore, OS X/Win 7, internal PCI-e SHDC Reader
Mini3: Mini10v. Black, 2G, Webcam, 640G HD, OS X 10.5.8/Win 7/Ubuntu [Hibernate w/NBI 0.8.3 RC4]
Dropbox Referral
Reply With Quote
  (#6) Old
Senior Member
 
ishagi's Avatar
 
Posts: 187
Join Date: Mar 2009
Location: Kanata, Ontario, Canada
Default Re: I know its there, just not where… - 05-02-2009, 04:02 AM

Does this give any hint on how it could be done?

http://ipis-osx.wikidot.com/forum/t-...-card-at-sleep

How to automatically unmount usb drive/sd card at sleep
TravHavlicek 7 Dec 2008, 04:15 -0-500


I have an SD card that is always in my 1000h. Whenever I would resume from sleep I would receive an error that the card was not correctly unmounted. Heres an article I found that will fix this problem.

http://www.windley.com/archives/2008/03 ... ives.shtml

If you followed every step from the install wiki, then you would have already installed Sleepwatcher. After you type 'sudo visudo' in the terminal, and add the correct line, you have to press 'Esc' and then type 'w:' (without the apostrophes) then press enter to save your changes. It doesn't tell you that in the guide, and just closing the terminal window will not save your changes.

Also if you just want to unmount a normal drive, not a backup drive linked to time machine, you would change the line:
sudo /sbin/umount -f /Volumes/Phil\ Backup
to
sudo /sbin/umount -f /Volumes/Phil
You would obviously change the word Phil to name of your external drive. If the name of your drive has a space in it, then you have to add quotation marks around the name of your drive. So if your drive was called 'SD Card' then it would look like this:
sudo /sbin/umount -f /Volumes/"SD Card"

Now my sd card unmounts correctly when I put it to sleep. Hope this helps someone.


EXCERPT:

Download and install SleepWatcher. There are two installs that have to be done in the right order (StartupItem last). Now whenever you restart SleepWatcher will start as well.

Modifiy your sudoers list. This allows umount to run as the superuser without a password (otherwise you have to type the superuser password everytime you put your Mac to sleep). Use the command sudo visudo to edit the sudoers file. If you don’t know vi, get someone to help with this step. You want to add the following line to the end of the sudoers file:

%admin ALL= NOPASSWD: /sbin/umount

This tells the sudo program to allow everyone in the %admin group to execute the umount command as the superuser without a password.

Create a .sleep file. This is where you actually unmount the drive. Put the following in a .sleep account in your home directory (you’ll have to create this file)

#/bin/bash
# always unmount the drive before sleep
sudo /sbin/umount -f /Volumes/Phil\ Backup

You’ll want to change /Volumes/Phil\ Backup to whatever the name of your backup drive is (look in /Volumes to find it). Make sure you make the .sleep file executable:

chmod u+x $HOME/.sleep

You can test it by executing the .sleep file from the command line. Your disk should unmount without asking for a password if you’ve done these steps correctly.

That’s it. Now when you sleep your machine the Time Machine drive will unmount automatically. You can add other things to the .sleep file if you like to accomplish anything else you’d like done before the machine sleeps. SleepWatcher will also execute a .wakeup file for things you want done when the machine wakes up.

http://www.bernhard-baehr.de/

SleepWatcher 2.0.5 (now compatible with Mac OS X 10.5 “Leopard”) is a command line tool (daemon) for Mac OS X that monitors sleep, wakeup and idleness of a Mac. It can be used to execute a Unix command when the Mac or the display of the Mac goes to sleep mode or wakes up or after a given time without user interaction. It also can send the Mac to sleep mode or retrieve the time since last user activity. A StartupItem, sample start and sleep scripts and the source code for sleepwatcher are included in the download. A little bit knowledge of the Unix command line is required to benefit from this software. You can also download a standalone source code archive for SleepWatcher 2.0.5. SleepWatcher 2.0.5 runs with Mac OS X 10.3 to 10.5. For Mac OS X 10.1 to 10.3, there is still SleepWatcher 1.0.1 available. SleepWatcher is published under the GNU General Public License. Awhile ago, it was a Pick of the Week at Mac OS X Hints.


Dell Mini 9 (96Gb) | White | SL 10.6.5 + Win7 Pro using EasyBCD 2.0 | 2G GSkill 667 RAM | No Webcam | BIOS A05 | 32G Runcore SSD | 32G SDHC (ext) | 32G SDHC (int w/ MR04 Card) | 1505 802.11n | Internal BT | Chrome Apple Logo
Dell Vostro A90 (96Gb) | SL 10.6.5 | 2G HyperX | 0.3Webcam | BIOS A04 | 64G Runcore SSD | 32G SDHC (ext) | and other stock features
| CLICK HERE TO ADD AN INTERNAL SDHC CARD | | CLICK HERE TO TAKE THE HACKINTOSH POLL |
Reply With Quote
  (#7) Old
Expert Member
 
Posts: 692
Join Date: Mar 2009
Default Re: I know its there, just not where… - 05-02-2009, 04:32 AM

Didn't have time right now to read through everything but that sure looks just like what I nee.

Thanks!


Mini1: Vostro A90, Black, 2G, 1.3 Webcam, Bluetooth, 64G SuperTalent, OS X 10.6.4
Mini2: Mini9, Black, 2G, 0.3 Webcam, Bluetooth, 32G RunCore, OS X/Win 7, internal PCI-e SHDC Reader
Mini3: Mini10v. Black, 2G, Webcam, 640G HD, OS X 10.5.8/Win 7/Ubuntu [Hibernate w/NBI 0.8.3 RC4]
Dropbox Referral
Reply With Quote
  (#8) Old
Senior Member
 
ishagi's Avatar
 
Posts: 187
Join Date: Mar 2009
Location: Kanata, Ontario, Canada
Default Re: I know its there, just not where… - 05-04-2009, 03:19 AM

Quote:
Originally Posted by bsoplinger1
Didn't have time right now to read through everything but that sure looks just like what I nee.

Thanks!
FWIW, I've verified that Sleepwatcher 2.0.5 does work in OSX 10.5.6. Took me many trial-and-error attempts due to my not using VI for so many many years and not understanding the basic directory structure of OSX. ops:

Just follow the directions and the SDHC card (installed in the MR-04 PCIe mini card) will unmount when the Mini goes to sleep (obviously in OSX**). When waking up, a few seconds will pass and the SDHC card will be automatically re-mounted. No more USB "failure to eject properly" error messages.

(**BTW: Win7 auto unmounts and no errors are noted with the MR-04. I've not tested other OSs)


Dell Mini 9 (96Gb) | White | SL 10.6.5 + Win7 Pro using EasyBCD 2.0 | 2G GSkill 667 RAM | No Webcam | BIOS A05 | 32G Runcore SSD | 32G SDHC (ext) | 32G SDHC (int w/ MR04 Card) | 1505 802.11n | Internal BT | Chrome Apple Logo
Dell Vostro A90 (96Gb) | SL 10.6.5 | 2G HyperX | 0.3Webcam | BIOS A04 | 64G Runcore SSD | 32G SDHC (ext) | and other stock features
| CLICK HERE TO ADD AN INTERNAL SDHC CARD | | CLICK HERE TO TAKE THE HACKINTOSH POLL |
Reply With Quote
  (#9) Old
Expert Member
 
Posts: 692
Join Date: Mar 2009
Default Re: I know its there, just not where… - 05-04-2009, 04:46 PM

I'm fighting an illness right now so other than laying here and using my mini to read the forum I really haven't gotten around to doing too much with my mini like installing the PCI-e -> SDHC adapter. Just out of curiosity, did you just unmount the drive or did you use lsof to close down apps that might be hold files open on the SDHC card preventing it being unmounted?


Mini1: Vostro A90, Black, 2G, 1.3 Webcam, Bluetooth, 64G SuperTalent, OS X 10.6.4
Mini2: Mini9, Black, 2G, 0.3 Webcam, Bluetooth, 32G RunCore, OS X/Win 7, internal PCI-e SHDC Reader
Mini3: Mini10v. Black, 2G, Webcam, 640G HD, OS X 10.5.8/Win 7/Ubuntu [Hibernate w/NBI 0.8.3 RC4]
Dropbox Referral
Reply With Quote
  (#10) Old
Senior Member
 
ishagi's Avatar
 
Posts: 187
Join Date: Mar 2009
Location: Kanata, Ontario, Canada
Default Re: I know its there, just not where… - 05-11-2009, 01:20 PM

Quote:
Originally Posted by bsoplinger1
I'm fighting an illness right now so other than laying here and using my mini to read the forum I really haven't gotten around to doing too much with my mini like installing the PCI-e -> SDHC adapter. Just out of curiosity, did you just unmount the drive or did you use lsof to close down apps that might be hold files open on the SDHC card preventing it being unmounted?
I tried your code as you had defined here - http://mydellmini.com/forum/sdhc-min...-t4845s60.html

... but it did not work for me.

I'll send you a PM to see if you can hint me to the differences between your machine and mine. The standard SleepWatcher code, which simply unmounts, works fine -> sudo /sbin/umount -f /Volumes/XXX where XXX is the name of my SDHC volume.

EDIT: Ok, the new code (w/ error checking) works. Just have to pick the correct volume (diskXsY). Much thanks for the enhanced code, I especially like the logging feature.


Dell Mini 9 (96Gb) | White | SL 10.6.5 + Win7 Pro using EasyBCD 2.0 | 2G GSkill 667 RAM | No Webcam | BIOS A05 | 32G Runcore SSD | 32G SDHC (ext) | 32G SDHC (int w/ MR04 Card) | 1505 802.11n | Internal BT | Chrome Apple Logo
Dell Vostro A90 (96Gb) | SL 10.6.5 | 2G HyperX | 0.3Webcam | BIOS A04 | 64G Runcore SSD | 32G SDHC (ext) | and other stock features
| CLICK HERE TO ADD AN INTERNAL SDHC CARD | | CLICK HERE TO TAKE THE HACKINTOSH POLL |
Reply With Quote
Reply

« Can cloned OS X installation be used on another Mini 9? | Advantages of A05 »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Copyright © 2008-2011 MyDellMini.com.