2012-09-22

How to change the volume label to lowercase on an USB stick, memory card or any VFAT filesystem on Ubuntu Lucid

This blog post explains how to change the volume label to lower case on an USB stick, memory card or any other VFAT filesystem. The instructions given were verified for Ubuntu Lucid, but they may work on other Linux systems as well.

On the web some people claim it's not possible, but indeed it is. On the web there are instructions how to change the volume label with GParted or mlabel (part of Mtools) and palimpsest (Disk Utility), but none of them work, because these tools always convert lowercase to uppercase before setting the label. Nautilus, the default file manager for Ubuntu doesn't support changing the volume label at all.

mkdosfs (mkfs.vfat) lets the user specify the volume label using the -n flag, and lowercase letters are kept lowercase, but this tool recreates the filesystem, so all data will be lost.

The non-destructive solution below is a combination of the mlabel and dosfslabel command-line tools.

  1. Connect the device to the computer if not already connected.
  2. Open a terminal window.
  3. Run sudo blkid | grep ' TYPE="vfat"' and </proc/mounts grep ' vfat ' to figure out the name of the device (e.g. /dev/sdb1). Look around in /media etc. to confirm you have picked the right device. If unsure, unplug it, run the commands again, see it disappear, plug it back, and run the commands again.
  4. Unmount the device by running umount /dev/sdb1 (substituting /dev/sdb1 with the name of the device found above). If it was mounted, and the unmount failed, then close some windows, kill some programs (e.g. sudo fuser -m /dev/sdb1), and try unmounting again.
  5. Run sudo env MTOOLS_SKIP_CHECK=1 mlabel -i /dev/sdb1 ::x (substituting /dev/sdb1 with the name of the device found above). If the system can't find mlabel, then install it by running sudo apt-get install mtools , and try again.
  6. Run sudo dosfslabel /dev/sdb1 MyLabel (substituting MyLabel with the desired label and /dev/sdb1 with the name of the device found above). Ignore any warnings about boot sector differences. If the system can't find dosfslabel, then install it by running sudo apt-get install dosfstools , and try again.
  7. Run sudo blkid | grep ' TYPE="vfat"' , and examine its output to verify that the label has been changed properly.
  8. Optionally, unplug the device, and then plug it back in. The system will recognize it, and mount it under /media/MyLabel, without converting lowercase letters in the volume label to uppercase.

Please note that there is an 11 character limit on the length of a VFAT volume label. If you specify a longer label, it will be truncated. There is another restriction: the label can contain only (some) ASCII characters: accented letters etc. won't work.

2012-09-04

How to unlock an Android phone using adb if you know the password

This blog post explains how to unlock an Android phone using adb if you know the password. This can be useful if the touch screen of your phone is broken.

If you don't know the password, try any of the 9 methods in the article http://joyofandroid.com/how-to-unlock-android-phone/ instead.

Prerequisites:

  • You have a computer running Windows, Mac OS X or Linux.
  • You have a USB cable with which you can connect the phone to the computer.
  • USB debugging has been enabled on the phone. You can enable it in the Settings / Development menu (but you need a working touch screen for that).
  1. Install the adb command-line tool. It's part of the Platform SDK Tools SDK package. First download the Android SDK, then run the tools/android GUI tool, select Platform SDK Tools and install. The adb binary will be downloaded to platform-tools/adb .
  2. On Linux, follow these steps to make sure that your user has the permission to access the phone.
  3. Don't connect your phone yet to the computer via USB.
  4. Run adb devices and verify that it doesn't see the phone.
  5. If not enabled yet, enable USB debugging on the phone, in the Settings / Development menu.
  6. Connect the phone to your computer using an USB cable.
  7. Run adb devices and verify that it sees your phone.
  8. You will have to run the following two commands very quickly, i.e. faster than the screen blanking time on the phone.
  9. Run adb shell input text PASSWORD, replacing PASSWORD with your Android unlock password.
  10. Run adb shell input keyevent 66 to simulate pressing the Enter key. (See this page for event codes of other keys.)