Write Access to NTFS Formatted USB Sticks
- Kernel Configuration
- Creating the Filesystem on the Stick
- Access the NTFS Formatted Stick
- Related Information
The capacity of USB sticks finally reaches 8GB what makes it possible to put whole DVD images on an USB stick and carry them with you. There is only one problem - USB sticks are usually FAT32 formatted and that limits the filesize to 4GB - just not enough for a 4.7 GB DVD image.
If you exclusively use your stick with Linux, you probably want to format it with ext3. Even from Windows access might be possible through an ext3 driver for Windows.
But to be realistic, most of the Windows systems you come accross will not have the ext3
driver installed. That's why it's maybe a better option to use NTFS on the sticks. This small
article describes how to deal with NTFS formatted USB sticks under Linux.
2. Kernel Configuration
Your kernel must support write support for NTFS and filesystems in userspace. Most kernels shipped with popular Linux distributions should already support this. If you use a custom kernel you have to enable support for ntfs and userspace filesystems and recompile the Linux kernel:
# make menuconfig
File systems ---> | <M> Filesystem in Userspace support | | CD-ROM/DVD Filesystems ---> | | DOS/FAT/NT Filesystems ---> | +-------------------------------------------------+ | <M> MSDOS fs support | | <M> VFAT (Windows-95) fs support | | (437) Default codepage for FAT | | (iso8859-1) Default iocharset for FAT | | <*> NTFS file system support | | [ ] NTFS debugging support | | [*] NTFS write support | +-------------------------------------------------+
# make && make modules_install
Copy the new kernel to /boot and adapt your grub.conf if you use GRUB or
your lilo.conf and rerun lilo if you use LILO as bootmanager. If you use
an initrd image for booting this has also to be recreated.
3. Creating the Filesystem on the Stick
The filesystem on the stick should be the newest NTFS volume version. If you format it under Windows you end up with version 1.2 - so I recommend to use Linux to format the stick, this can be easily done with mkntfs:
# mkntfs -Q -L LARGEUSB /dev/sda1
The option »-L LARGEUSB« puts a volume label LARGEUSB to the filesystem. This can be used in place of a device when mounting the filesystem.
Check the NTFS version with ntfsinfo:
# ntfsinfo -q -m /dev/sda1 | grep -i version Volume Version: 3.1
4. Access the NTFS Formatted Stick
The standard NTFS driver (ntfs) only supports limited write support, so we use an enhanced version of the NTFS driver that is actually running in userspace (ntfs-3g). To check if you can mount your USB stick, type as root
# mount -t ntfs-3g /dev/sda1 /media/memory0
You should now be able to write files greater than 4GB to your USB stick. Without options the ntfs-3g driver mounts the NTFS volume world-writable. This might be ok for you - however, the example /etc/fstab entry below only allows the root user and members of the group wheel write access to it:
LABEL=LARGEUSB /media/memory0 ntfs-3g noauto,user,uid=0,gid=10,umask=002 0 0
5. Related Information