[Casper] Upgrading from Tiger to Leopard
Miles Leacy
miles.leacy at themacadmin.com
Fri Jan 9 08:19:06 PST 2009
Thanks for sharing! I'll have a poke at it to see how I can simplify it.
Are you still deploying Macs with hard drives smaller than 80GB? For my own
purposes and the types of environments I've been in lately, I'd probably
just remove the whole case section pertaining to $RAW_SIZE.
I'm curious as to your reasoning for making the home partition so much
smaller while devoting the majority of the disk to the boot volume. I
typically do it the other way around, though if you were concerned with
keeping home directory size under control, I can see using this approach.
My general disk space distribution is:
For 80GB (which is the smallest I encounter these days):
20GB Boot Volume
10GB Restore Volume
<remainder> Data Volume
For anything larger:
40GB Boot Volume
20GB Restore Volume
<remainder> Data Volume
I find that I don't need any more than 20GB for the OS and Applications. In
practice, I have rarely deployed a system that required any more than 10GB.
Where more disk space is available, I double it to allow for unexpected
growth. For apps with large amounts of template & resource data (such as
Final Cut), I deploy it to the /Users/Shared directory.
----------
Miles A. Leacy IV
Certified System Administrator 10.4
Certified Technical Coordinator 10.5
Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com
On Fri, Jan 9, 2009 at 8:15 AM, Daniel Farnworth <
daniel.farnworth at thecreativepartnership.co.uk> wrote:
> He he, thought that'd be popular.
>
> The script is fairly poorly written (I'm not a Bash wiz) so any
> improvements are welcome (please let me have any so I can improve mine).
>
> We run it as a 'before' script during our imaging process and it
> takes a look at the internal disks, tries to figure out which is the
> system disk or otherwise the disk in the first bay (Mac Pros only I
> think) and then partitions it up into various volumes that we want.
> Our post-flight script then takes the names of these and builds an
> fstab file which it writes down to /etc. It also moves our admin
> user's ('lwsadmin' in the script) home directory to /var/homes. We
> figured this may be wise just in case the data partition goes dead
> for any reason. Our OS image is pre-confd with lwsadmin's home
> pointing at the correct location, so you may want to excise this
> section and rely on using root to login in bad circumstances.
>
> Oh, the post script also 'hides' some of the partitions (Restore,
> Freespace etc) so they don't show on the desktop, check the resulting
> fstab to see how this is done.
>
> Be careful using this, it is destructive. Usual disclaimers apply =)
>
> ### Pre-install Partition Script
>
> #!/bin/bash -v
>
> exec 2>&1
>
> function rawdisksize {
> FLOAT=$1
> INT1=${FLOAT/.*}
> #if $(( INT1 % 10 )) then
> while (( INT1 % 10 ))
> do
> let INT1++
> done
> #fi
> echo "$INT1"
> }
>
>
> function partitionsizes {
>
> case $RAW_SIZE in
>
> 30)
> INTHD_SIZE=15
> HOMES_SIZE=10
> SCRATCH_SIZE=3
> RESTORE_SIZE=0
> ;;
>
> 40)
> INTHD_SIZE=20
> HOMES_SIZE=10
> SCRATCH_SIZE=5
> RESTORE_SIZE=0
> ;;
>
> 60)
> INTHD_SIZE=30
> HOMES_SIZE=10
> SCRATCH_SIZE=10
> RESTORE_SIZE=5
> ;;
>
> 80)
> INTHD_SIZE=40
> HOMES_SIZE=10
> SCRATCH_SIZE=10
> RESTORE_SIZE=10
> ;;
>
> 120)
> INTHD_SIZE=60
> HOMES_SIZE=20
> SCRATCH_SIZE=10
> RESTORE_SIZE=20
> ;;
>
> 160)
> INTHD_SIZE=80
> HOMES_SIZE=25
> SCRATCH_SIZE=10
> RESTORE_SIZE=25
> ;;
>
> 240)
> INTHD_SIZE=160
> HOMES_SIZE=25
> SCRATCH_SIZE=10
> RESTORE_SIZE=25
> ;;
>
> *)
> INTHD_SIZE=$(( ($RAW_SIZE / 100) * 66 ))
> HOMES_SIZE=$(( ($RAW_SIZE / 100) * 11 ))
> SCRATCH_SIZE=$(( ($RAW_SIZE / 100) * 11 ))
> RESTORE_SIZE=$(( ($RAW_SIZE / 100) * 11 ))
> ;;
> esac
>
> }
>
>
> # Define a function to define whether this is a 'Bay Capable' machine
> #function bayedmachine {
>
> # This needs to be written fairly soon
>
> #}
>
>
> if [ ! -e /Volumes/CP-IntHD-01/.cp-partition-done ]; then
>
> echo ${1}
> TARGETDISK=`diskutil info ${1} | grep "Device Identifier:" | awk
> '{ print $3 }' | cut -c 1-5`
> echo ${TARGETDISK}
>
> # now to partition the disk
> #
>
> if [ ! -z $TARGETDISK ]
> then
> TOTAL_SIZE=`diskutil info $TARGETDISK | grep "Total Size" |
> awk
> '{ print $3 }'`
> RAW_SIZE=$(rawdisksize $TOTAL_SIZE)
> partitionsizes
>
> echo "Total size of $TARGETDISK: $TOTAL_SIZE GB"
> echo "Raw size of $TARGETDISK: $RAW_SIZE GB"
> echo "CP-IntHD-01 Size: $INTHD_SIZE GB"
> echo "CP-Homes-01 Size: $HOMES_SIZE GB"
> echo "CP-Scratch-NOT-BackedUp Size: $SCRATCH_SIZE GB"
> echo "Restore Size: $RESTORE_SIZE GB"
>
>
> # Check processor type so we partition in the right format
>
> sysinfo=`system_profiler`
>
> countPPC=`echo ${sysinfo} | grep -c PowerPC`
> countIntel=`echo ${sysinfo} | grep -c Intel`
>
> if [ ${countPPC} -ge 1 -a ${countIntel} -eq 0 ]; then
> echo "Got a PPC in here"
> partition_scheme_type="APMFormat"
>
> elif [ ${countIntel} -ge 1 -a ${countPPC} -eq 0 ]; then
> echo "Intel Inside"
> partition_scheme_type="GPTFormat"
>
> else
> echo "Can't work out what kinda proc, it either
> ain't got one or
> could be a Cray?"
> exit 1
>
> fi
>
>
> # Set the partition going
>
> if [ $RESTORE_SIZE -gt 0 ]; then
>
> diskutil partitionDisk $TARGETDISK 4
> $partition_scheme_type \
> "Journaled HFS+" CP-IntHD-01 "$INTHD_SIZE"G
> \
> "Journaled HFS+" CP-Homes-01 "$HOMES_SIZE"G
> \
> "Journaled HFS+" CP-Scratch-NOT-BackedUp
> "$SCRATCH_SIZE"G \
> "Journaled HFS+" Restore "$RESTORE_SIZE"G
>
> else
>
> diskutil partitionDisk $TARGETDISK 3
> $partition_scheme_type \
> "Journaled HFS+" CP-IntHD-01 "$INTHD_SIZE"G
> \
> "Journaled HFS+" CP-Homes-01 "$HOMES_SIZE"G
> \
> "Journaled HFS+" CP-Scratch-NOT-BackedUp
> "$SCRATCH_SIZE"G
>
> fi
>
>
> chown root:admin /Volumes/CP-Homes-01
> chown root:admin /Volumes/CP-Scratch-NOT-BackedUp
> chown root:admin /Volumes/Restore
> chown root:admin /Volumes/Free-Space
>
> chmod g+w /Volumes/CP-Homes-01
> chmod g+w /Volumes/CP-Scratch-NOT-BackedUp
> chmod g+w /Volumes/Restore
> chmod g+w /Volumes/Free-Space
>
> touch /Volumes/CP-IntHD-01/.cp-partition-done
>
> else
>
> echo "Problem acquiring target disk, exiting";
> exit 1
>
> fi
>
> else
>
> echo "The partition scheme has already been created. Exiting"
> exit 0
>
> fi
>
> exit 0
>
>
> ### Post Install Script
>
> #!/bin/bash -v
>
> # Redirect STDERR to STDOUT
> exec 2>&1
>
> VOLSDIR="/Volumes/"
>
> ROOTVOL="CP-IntHD-01"
> HOMESVOL="CP-Homes-01"
>
> ROOTPATH="${VOLSDIR}${ROOTVOL}"
> HOMESPATH="${VOLSDIR}${HOMESVOL}"
>
>
>
>
> if [ -e "${1}/.cp-partition-done" ]; then
>
> # Ditto the contents of $ROOTPART/Users/Shared to their new location
>
> ditto -v "${1}/Users/Shared" "${HOMESPATH}/Shared"
> if (( ! $? )); then
>
> # Remove the old copy of $ROOTPART/Users/Shared
> echo "Done dittoing..."
> rm -vR "${1}/Users/Shared" || { echo "rm /Users/Shared
> failed" ; }
> rm -v "${1}/Users/.DS_Store" || { echo "rm /Users/.DS_Store
> failed" ; }
> rm -v "${1}/Users/.localized" || { echo "rm
> /Users/.localized
> failed" ; }
>
> if [ -e "${1}/var/homes/lwsadmin" ]; then
> rm -vR "${1}/Users/lwsadmin" || { echo "rm
> /Users/lwsadmin
> failed" ; }
> fi
>
> DEVID=`diskutil list | grep $HOMESVOL | awk '{print $6}'`
> UUID=`diskutil info $DEVID | grep UUID | /usr/bin/awk
> {'print $2'}`
> echo "# Remap the $HOMESPATH to /Users" >> $1/etc/fstab || {
> echo
> "'fstab' Stage 1 failed: $HOMESPATH" ; exit 1 ; }
> echo -e "UUID=${UUID}\t/Users\thfs\trw,nobrowse\t1\t1\n" >>
> $1/etc/
> fstab || { echo "'fstab' Stage 2 failed: $HOMESPATH" ; exit 1 ; }
>
> HIDDEN_VOLS=(Restore Free-Space)
>
> for volume in "${HIDDEN_VOLS[@]}"; do
>
> DEVID=`diskutil list | grep $volume | awk '{print
> $6}'`
> UUID=`diskutil info $DEVID | grep UUID |
> /usr/bin/awk {'print $2'}`
>
> echo "# Set the volume $volume to not mount at
> startup" >> $1/etc/
> fstab || { echo "'fstab' Stage 3 ($volume) failed: $volume" ; exit 1 ; }
> echo -e "UUID=${UUID}\tnone\thfs\trw,noauto\t1\t1\n"
> >> $1/etc/
> fstab || { echo "'fstab' Stage 4 ($volume) failed: $UUID" ; exit 1 ; }
>
> done
>
> fi
>
> touch "${1}/.cp-user-migration-done" || { echo "Task completion file
> could not be created" ; exit 1 ; }
>
> exit 0
>
> else
> # Log the error
> echo "Could not find partition completion file. It would be wise not
> to continue"
> # Exit with above 0 status
> exit 1
>
> fi
>
>
>
>
>
>
> On 9 Jan 2009, at 12:44, Damien Weiss wrote:
>
> >
> > YES!!!!! PLEASE!!!! Send that script on. That's something that I
> > would implement almost immediately.
> >
> > Thanks!
> > Damien
> >
> > On Jan 9, 2009, at 7:19 AM, Daniel Farnworth wrote:
> >
> >> I have a pre-
> >> install script that we use to do this for us if anyone is interested.
> >>
> >> Cheers
> >> Dan
> >
>
> --
> Daniel Farnworth
> IT Manager
> The Creative Partnership
> daniel.farnworth at thecreativepartnership.co.uk
>
> http://www.thecreativepartnership.co.uk
> Tel: +44 (0)20 7439 7762
> Fax: +44 (0)20 7437 1467
>
> PGP Public Key available
>
>
>
>
>
>
> The information contained in this communication is intended solely for the
> use of the individual or entity to whom it is addressed and others
> authorised to receive it. It may contain confidential or legally privileged
> information. If you are not the intended recipient you are hereby notified
> that any disclosure, copying, distribution or taking any action in reliance
> on the contents of this information is strictly prohibited and may be
> unlawful. If you have received this communication in error, please notify
> postmaster at thecreativepartnership.co.uk immediately and then delete this
> email from your system. Any views or opinions presented in this email are
> solely those of the author and do not necessarily represent those of The
> Creative Partnership. The Creative Partnership has taken every reasonable
> precaution to ensure that any attachment to this e-mail has been swept for
> viruses. However, The Creative Partnership cannot accept liability for any
> damage sustained as a result of software viruses and would advise that you
> carry out your own virus checks before opening any attachment.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090109/85ac7ae6/attachment.html
More information about the Casper
mailing list