Cool Solutions

Mounting USB hard drives for Disconnected Imaging


May 22, 2008 2:28 pm





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
  2. Boot the computer with the standard ZCM Imaging Boot CD
  3. Run the following command to create the directory to use for mounting the USB HD:
    mkdir /mnt/usbhd
  4. 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
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"

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.

1 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 5 (1 votes, average: 5.00 out of 5)
You need to be a registered member to rate this post.

Categories: Uncategorized


Disclaimer: This content is not supported by Micro Focus. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.

1 Comment

  1. By:krogers1

    maybe a silly question, but how do you set the script to run automatically?