The 5 Minute Guide - I Don't Have Time for All The Rest of This Stuff !
Stop the Presses! If you only need to configure an NTFS drive, have you considered ntfs-config? "sudo apt-get install ntfs-config", then start it via System Tools, NTFS Configuration Tool. This app will set up NTFS partitions to allow read/write access, if that is all you are looking for. Now back to our regular programming...
If you run into problems, read the rest of this guide. Let's get started:
A. Permanent Drives
1. Install Storage Device Manager (pysdm) via
Synaptic or :
sudo apt-get install pysdm
2. Make a backup of fstab (you may be in a rush, but you aren't reckless!):
sudo cp /etc/fstab /etc/fstab.bak
3. Start PySDM:
System > Administration > Storage Device Manager or
gksu pysdm &
4. The devices are listed in the left panel (sda, sdb, etc). If you click on the white triangle to the left of one of the devices (sda, sdb, etc) it will expand to show each partition on the device (sda1, sda2, etc).
- Expand the device by clicking the white triangle to the left and select the partition you wish to set up. If there is no previous SDM setup for this partition, a 'Configure Now' window appears. Select 'OK' to continue. Hit 'Refresh' if you don't see the device. If it's an external drive there is a good chance it will be listed last. If you aren't sure, see Section 5 for some hints for locating the correct partition.
5. Type the name of a mountpoint in the 'Name' window. The mountpoint you name will create and/or select your mountpoint in /media
- Example: If you enter my-data in the window, it will be mounted on /media/my-data
If you want a mountpoint other than /media, click on the 'folder' icon and select another folder.
6. Into the Options window, copy/paste the bold portion of the applicable line (there should be no spaces). The copy/paste information replaces the default entry of
Defaults
- ext2/3 data partitions:
Code:
root partition ( / ): relatime,errors=remount-ro
home partition (/home): nodev,nosuid,relatime
other partitions: defaults,users
After mounting, if necessary you can run chown and chmod on mounted ext3 mountpoints.
- sudo chown -R username:groupname /media/yourmountpoint
- Example: sudo chown -R drs305:mygroup /media/my-data
- chmod -R 755 /media/yourmountpoint (Run previous command first or preceed command with 'sudo')
- chmod -R 755 /media/my-data
- ntfs/vat partitions :
Code:
auto,users,uid=1000,gid=1000,utf8,dmask=027,fmask=137
- uid 1000 is owner - 1000 is the first user (created at install). Adjust to another uid if desired.
- group is uid 1000's group (rw for directories, r for files), others have no access. Group id can be set to any existing group. Common groups include 0 root, 46 plugdev (removable drives), 100 (often set to 'users'), and 100X (1000 is normally first user's group, 1001 second, etc).
- Ownership of ntfs and fat32 partitions is set at mounting - chown and chmod will not 'stick'.
- NTFS Note: An ntfs partition fstab entry should work with a simple 'ntfs-3g defaults' entry. The mountpoint will be owned by root, as will subfolders and files. However, the user can write and save these files. If the uid/gid etc are added to fstab, the mountpoint will still be owned by root but the subfolders and files will show they are owned by the user (uid=).
7.
Click on "Assistant" and uncheck "Mount file system in read-only mode".
8. Hit '
Apply'. Fstab has just been updated.
9. Hit the Unmount, then Mount Button. The device/partition should now reflect your selections.
10. Done.
Note: Fsck will not be run on this partition. Consider editing fstab to add this option for ext2/3 partitions. See Section 4.
B. Removable Drives. (
Skip this paragraph if you are trying to keep under 5 minutes!
) These drives should work without an entry in fstab. They are not mounted automatically but are mounted by going to
Places > Removable Media and selecting the removable device you wish to mount. There is a reason these devices are not normally listed in fstab - their designations are dynamic. As an example, the same removable device could be
sdc one time and and
sdg another. Fstab would not recognize the changed designation.
If you want to include a removable or external drive in fstab:
Since their designations (dev/sdXX) are not fixed entering them in fstab takes a little more work. Your fstab entry should identify the device with either a UUID or a label. This ensures that the fstab setting will still be valid whether the device is mapped as
sdc, sdh, etc. Create the fstab entry via SDM (steps 1-8), then manually edit fstab to 'lock in' the device label by replacing the
sdXX with either a label or UUID.
- By UUID:
Find the UUID: sudo blkid | grep 'UUID'
- By Label:
Check for a label: sudo blkid | grep 'LABEL'
If no label exists there are several options for labeling a partition. It can be done from within Gparted (Partition, Label) or via Ubuntu's "Disk Utility" (System, Administration, Disk Utility: Edit Filesystem Label in lower right).
You can also use the command line for labeling linux partitions using "tune2fs" or, for other formats, install labeling apps: sudo apt-get install ntfsprogs e2fsprogs
If making a new label, save yourself some trouble by NOT using a label name with spaces! (my-data or my_data, not 'my data')
- ntfs: sudo ntfslabel /dev/<device> LABELNAME Example: sudo ntfslabel /dev/sdg1 my-data
ext2/3: sudo tune2fs -L <label> <dev> # Example: sudo tune2fs -L /dev/sdg1 my-data
fat32: Labeling a fat32 device with data on it will put us over 5 minutes -sorry. Go to Label fat partitions
Run Steps 1-9 above. When you have completed Step 9 the fstab file will be updated to include the partition. However, it will be defined as /dev/sdXX. You now must change this designation to a label or uuid listing:
- Open fstab: gksu gedit /etc/fstab
Change '/dev/sdXX' to 'LABEL=LABELNAME' or 'UUID=123-abc'
Example of change:
/dev/sdg1 /media/my-data ... to UUID=123-abc /media/my-data ...
or
LABEL=LABELNAME /media/my-data ...