Friday, 24 February 2012

Disk Images Seems to be Automatically Unmounted?


this quite unusual case. quite simply; i'm using script mount disk-images @ start-up, triggered launchdaemon.

now, far can tell these images launch expected, when go looking them aren't mounted @ (they aren't attached) , can't life of me figure out why.

i'm going try extract relevant parts of shell script only, keep short i'll skipping of error-checks have i'm happy they're working expected anyway.

variable imagefile path disk-image (sparse bundles in case) , mountpoint folder want attach image to.

code:
# attach image-file  disks=`hdiutil attach -drivekey system-image=yes -nomount "$imagefile"`    # ad-hoc function lets disk identifier in spite of   # variable scoping issues due use of pipe  fngetdisk() {  	echo "$1" | while read identifier type name  	do  		if [ "apple_hfs" = "$type" ];  			echo $identifier  			break  		fi  	done  }    # find hfs volume mount  disk=$(fngetdisk "$disks")    # store permissions mount point  eval `stat -s "$mountpoint"`  owner="$st_uid:$st_gid"  perms="$st_mode"    # mount ram disk target mount point  mount -t hfs -o union,nobrowse,noatime $disk "$mountpoint"    # restore permissions mount point  chown $owner "$mountpoint"  chmod $perms "$mountpoint"
now, have error tests , echo statements every major part, appears working , console shows nothing success messages, yet 2 of 3 images i'm mounting aren't there after starting up. i've been unable determine why third image attached first 2 not.

in specific case i'm using disk images replace commonly accessed folders, in order avoid writing ssd (the disk images on volume). specific folders i'm switching out are:
/private/tmp (using ram disk)
/var/run (another ram disk)
/var/db (persistent disk image)
/var/folders (persistent disk image)
/var/log (persistent disk image)

now, 2 ram disks work fine, i've omitted part code. however, /var/db , /var/folders, despite appearing mount, unmounted time i've logged in.

particularly unusual /var/log getting disk identifier of disk14, despite appearing last in log, while /var/db , /var/folders getting disk15 , disk16 respectively. however, time i've finished logging in these 2 identifiers taken 2 core storage (encrypted) volumes. seems suggest /var/db , /var/folders somehow aren't mounting, yet not providing meaningful error (seems unlikely) or they're being unmounted on.

if run script manually mount expected, weird going on during startup.
 



Forums Macs macOS macOS


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment