Mounting USB hard drives for Disconnected Imaging

0 Likes

Editor's Note: This is a neat trick. For Linux newbies, it works by selecting the last "disk" device, which, if you've just inserted the USB, will be that one.



First, the quick and dirty directions that you can use on any ZENworks Imaging CD. These are helpful when you have not customized the imaging CD.




  1. Connect a USB HD to the computer

  • Boot the computer with the standard ZCM Imaging Boot CD

  • Run the following command to create the directory to use for mounting the USB HD:

    mkdir /mnt/usbhd

  • Run the following command to mount the USB HD:

    mount /dev/$(ls /dev | grep -E 'sd..' | tail -1) /mnt/usbhd




This command is nice for the linux newbie because it automatically picks out the right device to mount. You don't have to worry about things like: is it sdb1, sdc1, or ...?



To take this a step further, we cracked open the init.rd and added the /mnt/usbhd directory and set the following script to run automatically. We added the script via the add files method.




#! /bin/bash
#usbmount.sh
echo "Mounting usb hard drive"
usb=$(ls /dev | grep -E "sd.." | tail -1)
mount /dev/$usb /mnt/usbhd
echo "drive is mounted and ready for use"
exit



The best part of the script is its ability to simplify and demystify what can be a hard to grok process of mounting the correct device. I know as a linux newbie it was tricky to know which device to mount and when. I hope to enable our staff to use Novell ZCM toolset to its fullest potential and I hope this may help you too.



I want to add a special thanks to Marlene. She built the script above off of my idea of a process outlined with the quick and dirty steps.



P.S. This assumes you have formatted the external USB hard drive with EXT2, EXT3, or reiserfs.


Labels:

How To-Best Practice
Comment List
Related
Recommended