Changes

From SME Server
Jump to navigationJump to search
1,466 bytes added ,  14:33, 26 September 2007
Line 1: Line 1:  
===USB Disks===
 
===USB Disks===
 
{{Incomplete}}
 
{{Incomplete}}
 +
{{Warning box|NTFS partitions are not supported, please use either fat32/vfat or ext2/ext3}}
 +
====Introduction====
 +
=====The Problem=====
 +
SME will automatically mount connected USB disk drives into the /media folder.
 +
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.
    +
Imagine this example:
 +
* Connect USB 'A' to your system.  It is automatically assigned to /dev/sdc and auto-mounted to /media/usbdisk
 +
* Disconnect USB 'A' and connect USB 'B' (to the same or to a different USB port).  It will be assigned to /dev/sdc and auto-mounted to /media/usbdisk.
 +
* Re-connect USB 'A' while USB 'B' is still connected, and it will be assigned to /dev/sdd and auto-mounted to /media/usbdisk1.
   −
{{Warning box|NTFS partitions are not supported, please use either fat32/vfat or ext2/ext3}}
+
Or this example:
 +
* Connect USB 'A' to the second USB port on your SME.  It is assigned to /dev/sdc
 +
* Connect USB 'B' to the first USB port without disconnecting USB 'A'.  USB 'B' is assigned to /dev/sdd
 +
* Leave both drives connected and re-boot.  USB 'B' is now connected to /dev/sdc, while USB 'A' is connected to /dev/sdd!
   −
SME will automatically mount connected USB disk drives into the /media folder.
+
=====The Solution=====
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.
+
The easiest way to avoid this behavior and provide reliable mount points for your USB drives is to label each drive, then specify the desired mount point in /etc/fstab based on the drive label.  This will allow you to:
 +
* Reliably mount your USB drives to drive-specific directories regardless of what device is assigned to the drive by SME.  This would allow you to specify separate USB disks for specific ibays by using lines like these in /etc/fstab:<br>
 +
LABEL=Disk1 /home/e-smith/files/ibays/ibay-1/html ext3 defaults
 +
LABEL=Disk2 /home/e-smith/files/ibays/ibay-2/html ext3 defaults
 +
* Reliably mount multiple disks in the one location, in case you want to use a rotating set of disk drives for backups, by using lines like these in /etc/fstab (just don't connect two of these drives at the same time!):<br>
 +
LABEL=Disk1 /mnt/backup ext3 defaults
 +
LABEL=Disk2 /mnt/backup ext3 defaults
 +
LABEL=Disk3 /mnt/backup ext3 defaults
   −
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/usbdisk.  Additionally, if you connect drive 'A' to another USB port, it may auto-mount to /media/usbdisk1.
     −
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.
   
====Supported FileSystems====
 
====Supported FileSystems====
 
=====ext2/ext3=====
 
=====ext2/ext3=====
Line 82: Line 99:     
====labeling your USB drive====
 
====labeling your USB drive====
=====ext3=====
+
=====ext2/ext3=====
 
  e2label /dev/sdd1 MyLabel
 
  e2label /dev/sdd1 MyLabel
=====vfat=====
+
=====fat32/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!):
+
'''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
   −
Show the current label:
+
'''dosfslabel'''
mlabel -s e:
     −
Clear the volume label:
+
SME also includes <code>dosfslabel</code> which appears to be related to labeling "dos" drives.
mlabel -c e:
+
dosfslabel /dev/sdd1
 +
produces the following output:
 +
Warning: FAT32 support is still ALPHA.
 +
MyLabel
   −
Assign a new volume label:
+
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.
mlabel e:MyLabel
      
====Customizing fstab====
 
====Customizing fstab====
 +
 
Add the following line to the /etc/fstab
 
Add the following line to the /etc/fstab
 
  LABEL=MyLabel /mnt/affadevice ext3 defaults
 
  LABEL=MyLabel /mnt/affadevice ext3 defaults
Line 105: Line 138:  
* Replace 'ext3' with 'vfat' if your drive is formatted as fat32/vfat.
 
* Replace 'ext3' with 'vfat' if your drive is formatted as fat32/vfat.
 
* Replace /mnt/affadevice with the folder in which you want your USB drive mounted (here and in all "mount" commands)
 
* Replace /mnt/affadevice with the folder in which you want your USB drive mounted (here and in all "mount" commands)
 +
* Make sure that the mount directory (/mnt/affadevice in this example) 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.
    
====Mount your disk automatically at boot-up====
 
====Mount your disk automatically at boot-up====
Line 123: Line 158:  
====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: http://forums.contribs.org/index.php?topic=35466.0
* Here is a link to the Microsoft KB article on fat volume size limits: <br>http://support.microsoft.com/kb/314463<br>Summary: 32GB limit during XP Setup, 8 Terabyte otherwise
  −
* Here is a link to an old MS technote about fat32 limits with 'format' under Win2K: <br>http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/prork/prdf_fls_pxjh.mspx?mfr=true<br>Summary: ''format'' under Windows 2000 has a 32GB limitation.
  −
* Here is a link to some more info about fat32 along with a downloadable program for formatting large disks if you are having problems<br>http://www.ridgecrop.demon.co.uk/index.htm?fat32format.htm
  −
  −
      
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]

Navigation menu