Difference between revisions of "USBDisks"

From SME Server
Jump to navigationJump to search
m (Gave better formatting to echo output in script.)
 
(77 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 
===USB Disks===
 
===USB Disks===
{{Incomplete}}
+
{{Warning box|NTFS partitions are supported if you install ntfs-3g and ntfsprogs, please use either fat32/vfat or ext2/ext3/ext4}}
SME will automatically mount connected USB disk drives into the /media folder.
+
====Supported FileSystems====
 +
=====ext2/ext3/ext4=====
 +
<ol>
 +
<li> recommended for USB drives intended for use only on SME
 +
</li><li> works great under Linux
 +
</li><li> supports hard links, symlinks
 +
</li><li> can be read under Windows using ''explore2fs'' from http://www.chrysocome.net/explore2fs
 +
</li><li> File & Disk size limits depend on the block size used when formatting the disk.  SME defaults to a 1K block size.<br>1K block size: 16GB max file size, 2TB max disk size<br>2K block size: 256GB max file size, 8 TB max disk size.<br>4K block size: 2TB max file size, 16 TB max disk size
 +
<li> You can determine your current block size using (replace /dev/sdc1 with the correct value for your USB drive)<br>
 +
dumpe2fs -h /dev/sdc1
 +
</li></ol>
  
Auto-mounting will be performed based on the specific USB port used to connect your drives unless you use another method to specify mount points.
+
=====NTFS=====
 +
You can format and use the NTFS if you install from [[epel]] ntfs-3g and ntfsprogs
 +
See the complete features of [https://en.wikipedia.org/wiki/NTFS-3G ntfs-3g]
 +
yum install ntfs-3g ntfsprogs --enablerepo=epel
  
This means that if you insert USB drive 'A', it should auto-mount to /media/usbdisk.  If you now dismount this disk and mount drive 'B' in the same USB port, it, too, will auto-mount to /media/usbdiskAdditionally, if you connect drive 'A' to another USB port, it may auto-mount to /media/usbdisk1.
+
=====fat32/vfat=====
 +
<ol><li> pre-configured on most USB hard drives
 +
</li><li> supported natively by Windows
 +
</li><li> (2^32)-1 byte ( 4GB - 1 byte) maximum file size
 +
</li><li>Requires occasional defragmentation for optimal speed
 +
</li><li> Maximum disk size dependent on cluster size32KB Clusters would allow a disk of approximately 8TB</li></ol>
  
The easiest way to avoid this behavior is to provide a label for each of your USB drives, and specify the desired mount point in /etc/fstab based on the drive label.
+
====Identifying your USB drive====
====ext2/ext3 vs. FAT32/VFAT====
+
See [[USBDisks#USB_on_SME_8|USB_on_SME_8]] for SME 8 servers.
* ext2/ext3 works great under Linux
 
* ext2/ext3 supports hard links, symlinks
 
* ext2/ext3 can be read under Windows using http://www.chrysocome.net/explore2fs
 
* fat32/vfat comes pre-configured on most USB hard drives
 
* fat32/vfat is suppoted natively by Windows.
 
  
====Identifying your USB drive====
 
 
After connecting your USB drive, execute the command
 
After connecting your USB drive, execute the command
 
  mount
 
  mount
Line 32: Line 44:
  
 
====Formatting your USB drive====
 
====Formatting your USB drive====
=====ext3=====
+
=====ext2/ext3/ext4=====
Copied with slight changes from [[Affa#Alternatively_setup_a_USB_drive]]
+
<ol></li><li>Copied with slight changes from [[Affa#Alternatively_setup_a_USB_drive]]
# Connect a USB hard disk to the USB Bus. Now you must determine what device the kernel has assigned to the drive. View the /var/log/message and search for ''Initializing USB Mass Storage driver''. A few lines below you'll find the name of the device. In this example it is ''sdc''. Replace ''/dev/sdc'' by ''your device'' in following instructions.
+
</li><li>Connect a USB hard disk to the USB Bus. Now you must determine what device the kernel has assigned to the drive. View the /var/log/message and search for ''Initializing USB Mass Storage driver''. A few lines below you'll find the name of the device. In this example it is ''sdc''. Replace ''/dev/sdc'' by ''your device'' in following instructions.
# Use the fdisk program to create a linux partition<br><code># fdisk /dev/sdc</code><br>You'll most likely find an existing vfat dos partition, which you have to delete first. In the following we assume, that you have created a single partition ''/dev/sdc1''.
+
Use the fdisk program to create a linux partition
# Now format the drive with an ext3 filesystem<br><code>mkfs.ext3 -L MyLabel /dev/sdc1</code>
+
fdisk /dev/sdc
# Make the mount point<br><code># mkdir -p /mnt/affadevice</code>
+
You'll most likely find an existing vfat dos partition, which you have to delete first. Refer to http://wiki.contribs.org/AddExtraHardDisk#Partitioning_the_disk for steps to create a partition. In the following we assume, that you have created a single partition ''/dev/sdc1''.
# Customize /etc/fstab as shown here: [[USBDisks#Customizing_fstab|Customizing fstab]]
+
</li><li>Now format the drive with an ext3 filesystem
# Mount the drive<br><code>mount /mnt/affadevice</code>
+
mkfs ext3 -L MyLabel /dev/sdc1
# Crosscheck your work using the df command<br><code># df</code>
+
</li><li>or format the drive with an ext4 filesystem
 +
mkfs ext4 -L MyLabel /dev/sdc1
 +
</li><li>Make the mount point
 +
mkdir -p /media/usbdevice
 +
</li><li>Customize /etc/fstab as shown here: [[USBDisks#Customizing_fstab|Customizing fstab]]
 +
</li><li>Mount the drive
 +
mount reads /etc/fstab to look for instructions on what to do if not specifically told on the command line.  After updating /etc/fstab as recommended, you can "mount" your USB disk reliably by specifying either the target directory:
 +
mount /media/usbdevice
 +
or the disk label:
 +
mount LABEL=MyLabel
 +
</li><li>Crosscheck your work using  
 +
df -h
 +
</li></ol>
 +
 
 +
=====fat32/vfat=====
 +
You can format your drive from your SME server using
 +
mkfs.vfat -n MyLabel /dev/sdd1
 +
Since this command will '''destroy irretrievably''' all information on the specified device (/dev/sdd1 in this case), be very sure you know exactly which device is the drive you want to format!
 +
 
 +
=====NTFS=====
  
=====vfat=====
+
You can format and use the NTFS if you install from [[epel]] ntfs-3g and ntfsprogs
It's probably easier to format your vfat drive on your windows system. You *must* have one, or you wouldn't be using this format...
+
  yum install ntfs-3g ntfsprogs --enablerepo=epel
  
If that sounds unhelpful, you could try ('''warning, untested!'''):
+
then
mkfs.vfat -n MyLabel /dev/sdd1
+
  mkfs.ntfs -n MyLabel /dev/sdd1
 +
Since this command will '''destroy irretrievably''' all information on the specified device (/dev/sdd1 in this case), be very sure you know exactly which device is the drive you want to format!
  
 
====labeling your USB drive====
 
====labeling your USB drive====
=====ext3=====
+
Only required if you didn't label your drive using the previous section.
 +
 
 +
=====ext2/ext3/ext4=====
 
  e2label /dev/sdd1 MyLabel
 
  e2label /dev/sdd1 MyLabel
=====vfat=====
+
 
Linux uses 'mtools' to manage FAT, FAT32, and VFAT partitions.  'mtools' uses drive letters to access devices.  These drive letters must be defined in /etc/mtools.conf before any of the mtools will work.  You can create a definition for your USB drive using a command like this one (be sure to replace /dev/sdd1 with the device name identified above for your USB drive!):
+
=====fat32/vfat=====
 +
'''mtools'''
 +
 
 +
SME includes 'mtools' which can be used to manage FAT, FAT32, and VFAT partitions.   
 +
 
 +
'mtools' uses drive letters instead of device names to access devices.  These drive letters must be defined in /etc/mtools.conf before any of the mtools will work.   
 +
 
 +
You can add your USB drive to /etc/mtools.conf using a command like the one shown below. However,
 +
* be sure to replace /dev/sdd1 with the device name identified above for your USB drive
 +
* be aware that the assigned device may change each time you reconnect your drive or reboot!
 
  echo 'drive e: file="/dev/sdd1"' >> /etc/mtools.conf
 
  echo 'drive e: file="/dev/sdd1"' >> /etc/mtools.conf
  
Once you have created the drive letter in mtools.conf you can view or edit the disk label using the following commands.
+
Once you have created the drive letter in mtools.conf you can view or edit the disk label using the following commands:
 +
* Show the current label:
 +
mlabel -s e:
 +
* Clear the volume label:
 +
mlabel -c e:
 +
* Assign a new volume label:
 +
mlabel e:MyLabel
 +
 
 +
'''dosfslabel'''
 +
 
 +
SME also includes <code>dosfslabel</code> which appears to be related to labeling "dos" drives.
 +
dosfslabel /dev/sdd1
 +
produces the following output:
 +
Warning: FAT32 support is still ALPHA.
 +
MyLabel
 +
 
 +
While it is safe to use <code>dosfslabel</code> to check the label on a drive, you should not use it to create or change the label on any drive that contains data you care about.
  
Show the current label:
+
====Dual Partitions====
mlabel -s e:
+
A method to use both ext3 and vfat<br>
 +
eg. an ext3 partition the size of your server, for an rsync backup.<br>
 +
the rest as vfat for easier portability
  
Clear the volume label:
+
Plug in your drive or check it is unmounted
mlabel -c e:
 
  
Assign a new volume label:
+
fdisk /dev/sdd
  mlabel e:MyLabel
+
p - print existing partitions
 +
d - delete partitions
 +
n - create new partitions
 +
p (primary), 1, +160G (the size you want)
 +
n - create 2nd partition
 +
p (primary), 2, return (rest of the disk)
 +
p - print and check
 +
w - write
 +
 +
mkfs.ext3 -L MaxExt3 /dev/sdd1
 +
  mkfs.vfat -n MaxVfat /dev/sdd2
  
 
====Customizing fstab====
 
====Customizing fstab====
Add the following line to the /etc/fstab<br><code>LABEL=MyLabel /mnt/affadevice ext3 defaults</code>
 
  
* Replace 'ext3' with 'vfat' if your drive is formatted as vfat.
+
Add the following line to the /etc/fstab
* Replace /mnt/affadevice with the folder in which you want your USB drive mounted
+
LABEL=MyLabel /media/affadevice ext3 defaults
 +
 
 +
* Replace 'ext3' with 'vfat' if your drive is formatted as fat32/vfat.
 +
* Replace 'ext3' with 'ext4' if your drive is formatted as ext4.
 +
* Replace /media/affadevice with the folder in which you want your USB drive mounted (here and in all "mount" commands)
 +
* Make sure that the mount directory (/media/affadevice in this example) exists and is empty!  Linux will not mount a drive in a directory that is not empty.
 +
* Add multiple entries as described in [[USBDisks#The_Solution]] to meet your specific requirements.
 +
 
 +
Or for ntfs
 +
/dev/NTFS-partition /media/affadevice ntfs-3g defaults   0      0
  
 
====Mount your disk automatically at boot-up====
 
====Mount your disk automatically at boot-up====
Line 82: Line 160:
  
 
Once the script exists you can add additional mount commands by editing S95mount_USB using:
 
Once the script exists you can add additional mount commands by editing S95mount_USB using:
  pico -w /etc/e-smith/events/local/S95mount_USB
+
  nano -w /etc/e-smith/events/local/S95mount_USB
 +
 
 +
The 'local' event will run each time your server boots up.  If you connect or disconnect a drive and need to re-mount it you can re-run your auto-mount commands using:
 +
signal-event local
 +
 
 +
====Mount your disks automatically when connected====
 +
{{incomplete}}
 +
|Please edit this section to specify how to get SME to automatically mount USB drives when they are connected
 +
====Format limitations when linking disk to an ibay====
 +
If you wish to mount an external USB drive, and then add a link in a ibay to that drive, then in order to change ownership and have write access you must format the drive as ext3 only. Refer this forum thread for info
 +
http://forums.contribs.org/index.php?topic=40240.new;topicseen#new
  
 
====More Information====
 
====More Information====
* There is a contrib for managing USB disks: http://forums.contribs.org/index.php?topic=35466.0
+
* There is a contrib for managing USB disks:<br>http://forums.contribs.org/index.php?topic=35466.0
 +
* There is evidence that some external USB enclosures are incompatible with SME:<br> http://forums.contribs.org/index.php?topic=39114.msg178646#msg178646
 +
* Darrell May's HowTo on scrubbing and re-formatting a USB disk:<br> http://distro.ibiblio.org/pub/linux/distributions/smeserver/contribs/dmay/smeserver/7.x/smeserver-usb-disk-howto.htm
 +
 
 +
====USB on SME 8====
 +
Things change on SME 8
 +
: It's difficult to work out what your device name is ie /dev/sda1 
 +
: The mount point isn't automatically added in /etc/fstab
 +
 
 +
We use hal for the first and manually create and mount for the second
 +
 
 +
=====Find the Drive Name=====
 +
To find  the device name, label, filesystem and the uid
 +
Create the file hal-find-by-property.sh
 +
 
 +
nano hal-find-by-property.sh
 +
 
 +
paste the text below into the file and save it.
 +
 
 +
#! /bin/bash
 +
hal-find-by-property --key volume.fsusage --string filesystem |
 +
while read udi ; do
 +
    # ignore optical discs
 +
    if test [[ "$(hal-get-property --udi $udi --key volume.is_disc)" == "false" ]]; then
 +
        dev=$(hal-get-property --udi $udi --key block.device)
 +
        fs=$(hal-get-property --udi $udi --key volume.fstype)
 +
        lb=$(hal-get-property --udi $udi --key volume.label)
 +
        echo device: $dev", label: "$lb", file system: "$fs", uid: "$udi
 +
    fi
 +
done
 +
 
 +
Make the file executable.
 +
chmod +x hal-find-by-property.sh
 +
 
 +
Run the file with the USB drive attached and read the output of the file from the terminal.
 +
sh hal-find-by-property.sh
 +
 
 +
The output will tell you the device, volume label, file system type, and the uid. If this is a new drive you have to run fdisk to create a partition and format the drive before you can mount it.
 +
=====Run fdisk on the Drive=====
 +
 
 +
To create a partition with fdisk, use the device output from the hal-find-by-property.sh script as the argument to the fdisk command. If the output from hal-find-by-property.sh is /dev/sdb1 the fdisk command will be
 +
fdisk /dev/sdb1
 +
 
 +
You can list the partitions on the disk by entering the p command when prompted. It's a good idea to see what partitions exist before you start. If the drive is pre-formatted for fat or ntfs it's good practice to delete the factory partitions.
 +
 
 +
If this is a new drive, you will need to create a new primary partition. Do this by entering an n at the prompt followed by p for primary. Enter a partition number of 1. fdisk will then ask for the first and last sector. If you are formatting a new disk, hit enter at both questions. This will use the entire disk. When the process ends, hit p to verify you have the disk setup like you want it. Once you are happy with the partition table, hit w to write the partition table and exit fdisk.
 +
 
 +
=====Format The Drive=====
 +
 
 +
You now need to format the drive. To format the drive with an ext3 filesystem located at /dev/sdb1 and give it a label of usbdrive, issue the following command:
 +
mkfs.ext3 -L usbdrive /dev/sdb1
 +
 
 +
=====Mount The Drive=====
 +
 
 +
Finally you mount the drive. As mentioned before, the mount point has to exist before you issue the mount command. A typical place for USB drives to be mounted is /media. If there is already a mount point in /media you can check it by listing the directory contents of media.
 +
ll /media
 +
 
 +
Once you have a suitable location, make sure nothing is mounted there by issuing the mount command from the terminal with no arguments. If you wanted to mount the drive /dev/sdb1 at /media/usbdrive, you would issue the following command
 +
 
 +
mount /dev/sdb1 /media/usbdrive
 +
ls -lh /media/usbdrive/
 +
 
 +
=====UnMount the Drive=====
 +
 
 +
Unmount the drive before unplugging it with
 +
umount /dev/sdb1
 +
 
 +
Note:  When configuring a USB drive to be used by the built in [[SME_Server:Documentation:Administration_Manual:Chapter10|Workstation Backup To USB]] you must ensure that the drive is not mounted automatically.  When configuring the Workstation Backup, it will look for unmounted removable drives and allow you to select what you want.  If the drive is already mounted when you configure it then you will get an error saying "No Removable disk available".
  
 +
The same applies for the [[SME_Server:Documentation:Administration_Manual:Chapter6#Option_8:_Perform_backup_to_USB_device|Console Backup to USB]]
  
 
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]
 +
[[Category:Administration:Storage]]

Latest revision as of 14:29, 8 March 2016

USB Disks

Warning.png Warning:
NTFS partitions are supported if you install ntfs-3g and ntfsprogs, please use either fat32/vfat or ext2/ext3/ext4


Supported FileSystems

ext2/ext3/ext4
  1. recommended for USB drives intended for use only on SME
  2. works great under Linux
  3. supports hard links, symlinks
  4. can be read under Windows using explore2fs from http://www.chrysocome.net/explore2fs
  5. File & Disk size limits depend on the block size used when formatting the disk. SME defaults to a 1K block size.
    1K block size: 16GB max file size, 2TB max disk size
    2K block size: 256GB max file size, 8 TB max disk size.
    4K block size: 2TB max file size, 16 TB max disk size
  6. You can determine your current block size using (replace /dev/sdc1 with the correct value for your USB drive)
    dumpe2fs -h /dev/sdc1
NTFS

You can format and use the NTFS if you install from epel ntfs-3g and ntfsprogs See the complete features of ntfs-3g

yum install ntfs-3g ntfsprogs --enablerepo=epel
fat32/vfat
  1. pre-configured on most USB hard drives
  2. supported natively by Windows
  3. (2^32)-1 byte ( 4GB - 1 byte) maximum file size
  4. Requires occasional defragmentation for optimal speed
  5. Maximum disk size dependent on cluster size. 32KB Clusters would allow a disk of approximately 8TB

Identifying your USB drive

See USB_on_SME_8 for SME 8 servers.

After connecting your USB drive, execute the command

mount

and look for anything mounted in /media/???.

If your drive did not auto-mount, search /var/log/messages for the kernel commands related to your device using:

egrep "(kernel|fstab|scsi).*(usb|USB)" /var/log/messages

You should have a line logged by fstab-sync giving the auto-mount folder created and the device name for your new device that looks like this:

Sep 23 17:11:14 office fstab-sync[32193]: added mount point /media/usbdisk1 for /dev/sdd1

You should now be able to mount your USB drive using the values found in /var/log/messages. In our example, that would mean:

mount /media/usbdisk1

or

mount /dev/sdd1

Formatting your USB drive

ext2/ext3/ext4
  1. Copied with slight changes from Affa#Alternatively_setup_a_USB_drive
  2. Connect a USB hard disk to the USB Bus. Now you must determine what device the kernel has assigned to the drive. View the /var/log/message and search for Initializing USB Mass Storage driver. A few lines below you'll find the name of the device. In this example it is sdc. Replace /dev/sdc by your device in following instructions. Use the fdisk program to create a linux partition fdisk /dev/sdc You'll most likely find an existing vfat dos partition, which you have to delete first. Refer to http://wiki.contribs.org/AddExtraHardDisk#Partitioning_the_disk for steps to create a partition. In the following we assume, that you have created a single partition /dev/sdc1.
  3. Now format the drive with an ext3 filesystem mkfs ext3 -L MyLabel /dev/sdc1
  4. or format the drive with an ext4 filesystem mkfs ext4 -L MyLabel /dev/sdc1
  5. Make the mount point mkdir -p /media/usbdevice
  6. Customize /etc/fstab as shown here: Customizing fstab
  7. Mount the drive mount reads /etc/fstab to look for instructions on what to do if not specifically told on the command line. After updating /etc/fstab as recommended, you can "mount" your USB disk reliably by specifying either the target directory: mount /media/usbdevice or the disk label: mount LABEL=MyLabel
  8. Crosscheck your work using df -h
fat32/vfat

You can format your drive from your SME server using

mkfs.vfat -n MyLabel /dev/sdd1

Since this command will destroy irretrievably all information on the specified device (/dev/sdd1 in this case), be very sure you know exactly which device is the drive you want to format!

NTFS

You can format and use the NTFS if you install from epel ntfs-3g and ntfsprogs

yum install ntfs-3g ntfsprogs --enablerepo=epel

then

 mkfs.ntfs -n MyLabel /dev/sdd1

Since this command will destroy irretrievably all information on the specified device (/dev/sdd1 in this case), be very sure you know exactly which device is the drive you want to format!

labeling your USB drive

Only required if you didn't label your drive using the previous section.

ext2/ext3/ext4
e2label /dev/sdd1 MyLabel
fat32/vfat

mtools

SME includes 'mtools' which can be used to manage FAT, FAT32, and VFAT partitions.

'mtools' uses drive letters instead of device names to access devices. These drive letters must be defined in /etc/mtools.conf before any of the mtools will work.

You can add your USB drive to /etc/mtools.conf using a command like the one shown below. However,

  • be sure to replace /dev/sdd1 with the device name identified above for your USB drive
  • be aware that the assigned device may change each time you reconnect your drive or reboot!
echo 'drive e: file="/dev/sdd1"' >> /etc/mtools.conf

Once you have created the drive letter in mtools.conf you can view or edit the disk label using the following commands:

  • Show the current label:
mlabel -s e:
  • Clear the volume label:
mlabel -c e:
  • Assign a new volume label:
mlabel e:MyLabel

dosfslabel

SME also includes dosfslabel which appears to be related to labeling "dos" drives.

dosfslabel /dev/sdd1

produces the following output:

Warning: FAT32 support is still ALPHA.
MyLabel

While it is safe to use dosfslabel to check the label on a drive, you should not use it to create or change the label on any drive that contains data you care about.

Dual Partitions

A method to use both ext3 and vfat
eg. an ext3 partition the size of your server, for an rsync backup.
the rest as vfat for easier portability

Plug in your drive or check it is unmounted

fdisk /dev/sdd
p - print existing partitions
d - delete partitions
n - create new partitions
p (primary), 1, +160G (the size you want)
n - create 2nd partition
p (primary), 2, return (rest of the disk)
p - print and check
w - write

mkfs.ext3 -L MaxExt3 /dev/sdd1
mkfs.vfat -n MaxVfat /dev/sdd2

Customizing fstab

Add the following line to the /etc/fstab

LABEL=MyLabel /media/affadevice ext3 defaults
  • Replace 'ext3' with 'vfat' if your drive is formatted as fat32/vfat.
  • Replace 'ext3' with 'ext4' if your drive is formatted as ext4.
  • Replace /media/affadevice with the folder in which you want your USB drive mounted (here and in all "mount" commands)
  • Make sure that the mount directory (/media/affadevice in this example) exists and is empty! Linux will not mount a drive in a directory that is not empty.
  • Add multiple entries as described in USBDisks#The_Solution to meet your specific requirements.

Or for ntfs

/dev/NTFS-partition /media/affadevice ntfs-3g defaults	  0       0

Mount your disk automatically at boot-up

Use the following commands to create a script that will run at each re-boot if you want to re-mount your USB disk automatically:

cat <<EOF > /etc/e-smith/events/local/S95mount_USB
#! /bin/sh
mount LABEL=MyLabel
EOF

chmod +x /etc/e-smith/events/local/S95mount_USB

Once the script exists you can add additional mount commands by editing S95mount_USB using:

nano -w /etc/e-smith/events/local/S95mount_USB

The 'local' event will run each time your server boots up. If you connect or disconnect a drive and need to re-mount it you can re-run your auto-mount commands using:

signal-event local

Mount your disks automatically when connected

Incomplete.png Incomplete:
This article or section needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page


|Please edit this section to specify how to get SME to automatically mount USB drives when they are connected

Format limitations when linking disk to an ibay

If you wish to mount an external USB drive, and then add a link in a ibay to that drive, then in order to change ownership and have write access you must format the drive as ext3 only. Refer this forum thread for info http://forums.contribs.org/index.php?topic=40240.new;topicseen#new

More Information

USB on SME 8

Things change on SME 8

It's difficult to work out what your device name is ie /dev/sda1
The mount point isn't automatically added in /etc/fstab

We use hal for the first and manually create and mount for the second

Find the Drive Name

To find the device name, label, filesystem and the uid Create the file hal-find-by-property.sh

nano hal-find-by-property.sh

paste the text below into the file and save it.

#! /bin/bash
hal-find-by-property --key volume.fsusage --string filesystem |
while read udi ; do
   # ignore optical discs
   if test "$(hal-get-property --udi $udi --key volume.is_disc)" == "false" ; then
       dev=$(hal-get-property --udi $udi --key block.device)
       fs=$(hal-get-property --udi $udi --key volume.fstype)
       lb=$(hal-get-property --udi $udi --key volume.label)
       echo device: $dev", label: "$lb", file system: "$fs", uid: "$udi
   fi
done

Make the file executable.

chmod +x hal-find-by-property.sh

Run the file with the USB drive attached and read the output of the file from the terminal.

sh hal-find-by-property.sh

The output will tell you the device, volume label, file system type, and the uid. If this is a new drive you have to run fdisk to create a partition and format the drive before you can mount it.

Run fdisk on the Drive

To create a partition with fdisk, use the device output from the hal-find-by-property.sh script as the argument to the fdisk command. If the output from hal-find-by-property.sh is /dev/sdb1 the fdisk command will be

fdisk /dev/sdb1

You can list the partitions on the disk by entering the p command when prompted. It's a good idea to see what partitions exist before you start. If the drive is pre-formatted for fat or ntfs it's good practice to delete the factory partitions.

If this is a new drive, you will need to create a new primary partition. Do this by entering an n at the prompt followed by p for primary. Enter a partition number of 1. fdisk will then ask for the first and last sector. If you are formatting a new disk, hit enter at both questions. This will use the entire disk. When the process ends, hit p to verify you have the disk setup like you want it. Once you are happy with the partition table, hit w to write the partition table and exit fdisk.

Format The Drive

You now need to format the drive. To format the drive with an ext3 filesystem located at /dev/sdb1 and give it a label of usbdrive, issue the following command:

mkfs.ext3 -L usbdrive /dev/sdb1
Mount The Drive

Finally you mount the drive. As mentioned before, the mount point has to exist before you issue the mount command. A typical place for USB drives to be mounted is /media. If there is already a mount point in /media you can check it by listing the directory contents of media.

ll /media

Once you have a suitable location, make sure nothing is mounted there by issuing the mount command from the terminal with no arguments. If you wanted to mount the drive /dev/sdb1 at /media/usbdrive, you would issue the following command

mount /dev/sdb1 /media/usbdrive
ls -lh /media/usbdrive/
UnMount the Drive

Unmount the drive before unplugging it with

umount /dev/sdb1 

Note: When configuring a USB drive to be used by the built in Workstation Backup To USB you must ensure that the drive is not mounted automatically. When configuring the Workstation Backup, it will look for unmounted removable drives and allow you to select what you want. If the drive is already mounted when you configure it then you will get an error saying "No Removable disk available".

The same applies for the Console Backup to USB