Howto: access removable media from andLinux

From andLinux

Jump to: navigation, search

Accessing removable media from andLinux using COFS

Abstract

Having instant access to hot pluggable or removable media (such as USB sticks) on andLinux can be tricky. There is no direct way to do so from the UI and users typically have to edit fstab or other configuration files, with mixed success. In addition, automatic mounting is not fully supported and the mounted volume may no longer be accessible to Windows.

Workaround

Fortunately, there is a solution to that, using Windows itself and the power of NTFS. Like Unix file systems, NTFS supports mount points, which allows a physical drive to be mounted inside an empty directory and its contents seamlessly displayed. This works for USB drives and CD/DVDs as long as the host drive is formatted with NTFS. The external drive can be formatted with anything that Windows will read.

Here's how to mount a drive as a directory in Windows XP:

  • Insert the external drive or media
  • Open Control Panel/Administrative tools
  • Open Computer Management
  • Select Disk Management in the storage section
  • Right-click the desired drive or partition
  • Select "Change drive letter and path"
  • Add a mount point to an empty NTFS folder
  • If you want, you can now remove the drive letter in the previous dialog

andLinux/coLinux having mounted a NTFS partition as cofs will see these subdirectories as genuine NTFS folders. Any automatic volume mounting will be handled by Windows and will be transparent to Linux.

Other low level NTFS features that will show up in mounted cofs partitions are junction points and hard links, which are equivalent to directory symlinks and file hard links in Linux. These features are hidden from the standard UI but can be accessed with free third party tools like Alax.Info NTFS Links.

Accessing non-Windows compatible media

The directions above are the way to go if your media is readable by Windows but what if it's formatted with a Linux filesystem that Windows won't recognize? The following instructions have been used successfully on Windows Vista.

Start a windows command line: cmd.exe and run diskpart.exe;

  *** 1s Microsoft Windows [Version 6.0.6001]
  Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
  
  C:\>diskpart

Another window will open and you should see something like the following;

  Microsoft DiskPart version 6.0.6001
  Copyright (C) 1999-2007 Microsoft Corporation.
  On computer: XXXXX-VISTA
  
  DISKPART>

Use diskpart to determine the harddisk number and partition number.

First list all disks;

 DISKPART> list disk
 
 Disk ###  Status      Size     Free     Dyn  Gpt
 --------  ----------  -------  -------  ---  ---
 Disk 0    Online       298 GB      0 B
 Disk 1    Online        75 GB      0 B

In this case the external disk is ~80GB so we need to list the partitions on "Disk 1", first we need to select it and then we can list the partitions;

 DISKPART> select disk 1
 
 Disk 1 is now the selected disk.
 
 DISKPART> list partition
 
 Partition ###  Type              Size     Offset
 -------------  ----------------  -------  -------
 Partition 1    Primary             71 GB    32 KB
 Partition 0    Extended          3153 MB    71 GB
 Partition 2    Logical           3153 MB    71 GB

We now have all the information we need to create device entry for the andLinux settings.txt file. The device to map is the first disk and the first partition, this translates to;

 hda1=\Device\Harddisk1\Partition1

You may choose to have something like the following in your /etc/fstab;

 /dev/hda1  /mnt/usb reiserfs  rw,user