Storage Device Manager - Fstab Configuration***
NOTE: pySDM has been around a while and is getting dated. An alternative which does much the same thing is Mount Manager (although even it is getting older, as it uses HAL, which is no longer required by Ubuntu). You can install it with "sudo apt-get install mountmanager". Start it via System > Administration > MountManager. If you use it, make sure you make a backup copy of your current /etc/fstab file before making changes with Mount Manager.
Storage Device Manager provides an GUI method to make changes to mounting options without manually editing any files. It is a bit old and fails to take advantage in improvements to the linux filesystem, such as using UUIDs and labels to identify partitions. Even when using this app, the user will need to make some changes to /etc/fstab to incorporate these improvements. It can serve as the basis for creating a new line in your /etc/fstab file but it isn't the complete solution it used to be. ntfs-config is an excellent and much simpler tool for creating a new fstab listing for NTFS partitions, which is the formatting used by Windows. It is discussed later. Users are encouraged to use the "5 Minute Guide" and reference the remainder for background information or if clarification is desired.
Note that pySDM does not make a back up copy of the /etcfstab file!
Before proceeding, please note that there are some excellent references for further information regarding fstab located at the bottom of this guide.
Users may also wish to consider the KDE application mountmanager, which is similar to PySDM but has greater capabilities and has been updated more recently. Here is one link to a site discussing mountmanager.
5 Minute Guide --- Installing & Starting --- Fstab Backup --- Using PySDM
When You Will Need Fstab --- Notes --- Partition Commands --- Links1. Installing & Starting Storage Device Manager (PySDM)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:
After mounting, if necessary you can run chown and chmod on mounted ext3 mountpoints.Code:root partition ( / ): relatime,errors=remount-ro home partition (/home): nodev,nosuid,relatime other partitions: defaults,users
- 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.
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 ...
LABEL=LABELNAME /media/my-data ...
Storage Device Manager is accessed via System > Administration > Storage Device Manager. From the command line, start it with "gksu pysdm". Root privilege is required since PySDM makes changes to system files. gksu is the cousin of sudo and should be used with graphical apps.
If Storage Device Manager is not in your menu, install it via synaptic ( System > Administration > Synaptic Package Manager ). If you don't see 'pysdm' listed in synaptic or the following command line method is not successful, go to Synaptic > Settings > Repositories > Ubuntu Software and make sure the 'universe' repository is checked. Hit the 'Reload' button to refresh the package list and then select pysdm. You can also install it via command line with:
2. Backup FstabCode:sudo apt-get install pysdm
Before modifying any system file, it is good practice to make a backup copy. If you intend to make multiple changes
within a short time, I'd recommend assigning each backup a unique number (fstab.bak1, bak2, etc). To make a backup:
3. Using PySDMCode:sudo cp /etc/fstab /etc/fstab.bak1
The PySDM interface consists of 3 sections: the Partition window for selecting the partition, the General Configuration window for setting fstab options, and the Dynamic configuration rules window for modifying hot-plug device and removable settings.
When Storage Device Manager starts, it reads the devices/partitions available to it and displays them in the far left window. Starting with Hardy, Ubuntu no longer refers to devices as hda even for IDE drives.
Select the partition which you want to mount by expanding the drive (sda, sdb, etc) and clicking on the triangle to the left of the individual partition (sda, sdb, etc). Until you select a partition the right side of PySDM will be grayed out and unavailable for input. If you don't know which partition you want to select, go to the Which Partition? section at the bottom of this page for help. The first time PySDM works with a partition, even if an entry already exists in fstab, it will ask 'Configure Now? - click OK.
Name is the mountpoint you wish to use, by default a subfolder of /media and named the same as the partition (e.g. 'sda3'). You can choose a more descriptive name, such as 'my-data' or whatever you wish. The folder will be created if it does not exist. The folder created and/or selected should be empty - do not select a folder already containing files or subfolders.
If you do not want to use /media as the base mountpoint you can choose a different folder by clicking on the folder icon and navigating to another folder. If you wish to make a new folder while navigating your system, click the 'new folder' at the top right of the navigation window. If you get 'lost' while navigating the folders, 'File System' in the left window will get you back to / .
Take a breath and relax - you don't have to make a decision here. Type is just informing you the type of partition you are working with (e.g. ext3, ntfs, vfat).
Here's the meat of the program. Initially 'Options' is set to 'defaults'. Clicking the 'Set Defaults' button also resets this window to 'defaults'. Selecting 'defaults' sets the following options: rw, suid, dev, exec, auto, nouser, async. Starting with Hardy, 'relatime' is also a default on native linux (i.e. ext2/3) partitions. For information on each of these settings, refer to the links at the bottom of this guide. If you add or change any options, 'defaults' will not be shown but will apply to any setting not overridden. One other note, in addition to automatic entries, anything you type in this window will be input in the options section of fstab. For instance, there is no option to set dmask or fmask but you can add them to the options line and they will be applied along with the other settings. All options are joined by commas with no spaces in the entire section.
This section could also be called 'More Options' since it is the section in which you can change settings from 'defaults'. Most of the settings are self-explanatory. The setting options presented vary with the type of partition selected (ext3, ntfs, fat32, etc). I will comment on a few of the options you may wish to consider changing. Any change you make in these sections will remove the 'defaults' option from the main window and non-default options will be displayed. Default settings will still apply to those settings which are not overridden.
Auto-selected items are colored blue. Black Bold items are the actual designations that appear in the fstab options section when selected. Default options are underlined. They will NOT appear in fstab but apply unless the associated non-default option is entered.
* Items which should be considered. Author recommendations are listed in green.
- Mounting Tab
- * Mount read-only *. ro The Read-Only option is OFF (rw) for linux ext2/3 partitions and ON* (ro) by default for VFAT/NTFS partitions. For VFAT/NTFS partitions, this option must be unchecked to enable read/write. For non-linux partitions, the PySDM umask (and dmask/fmask manual entries) setting can allow RW access for non-linux partitions even if RO is enabled.
- Allow group mount. group= Allow any group member to mount. Enter group id.
- * Allow any user to mount. users Normally the option would allow a user to click on a partition icon or use the 'mount /dev/sdXX' option to mount the partition without root privileges. If this option doesn't work for NTFS partitions try mounting via terminal. If you get an 'Unprivileged user' message, see the section at the bottom of the page on NTFS-3g errors.
- * Allow a user mount. nouser/user
- File system mounted at boot time. auto/noauto
- Owner of device can mount. owner
- Owner user of filesystem . uid= Enter uid in window. Whoever mounts the device owns it. Your uid is normally 1000 if you are the primary user. To check, run the following command in terminal: id. You may wish to select this option.
- Support extended attributes. --/user_xattr (Linux partitions only).
- * Check file system on mount time. (Linux partitions only). This command is no longer supported and may produce an error message. Do not select it. Fsck checks are no longer included in the options section; they are now handled by the last digit on the line (normally 0, 1 or 2).
- * Umask. 000 (Non-linux partitions only). This is an entire subject in itself. The PySDM menu does not offer dmask and fmask value inputs for ntfs/fat partitions. You can manually enter them them in the Options window if you wish.
On NTFS partitions, if the fstab options are left at "defaults" the mountpoint and all folders/files will be owned by root but readable/writable by the user. If uid/gid options are used, the mountpoint is still owned by root but all subfolders and files are owned by the user specified by "uid=".
Refer to the Permissions link at the bottom of the page for more information. Here are some common umask settings you may wish to consider:
000 (Permissions 777) - Default PySDM setting. Anyone can do anything!
022 (Permissions 755) - Owner read/write/execute (rwx), group (rx), others (rx).
027 (Permissions 750) - Owner rwx, group rx, others can't access partition.
077 (Permissions 700) - Only the owner can rwx, group and others cannot access partition.
* Instead of umask, dmask & fmask can be used but must be entered manually on the Options line. Two useful settings would be:
dmask 027,fmask137 - Owner has rwx for directories, rw for files. Group has rx for dirs and r for files.
dmask 000,fmask111 - Owner rwx dirs, rw files. Group rwx dirs, rw files. Others rwx dirs, rw files.
Deselect umask if dmask/fmask settings are entered in the Options window.
- Owner group of filesystem. gid=
- Special Files
- Permit execution of binaries. exec/noexec If unchecked, this option prevents execution of program files within the partition. This may be desirable for a storage or data partition which nevertheless contains executable files. Unchecking this box will also disable the warning message in nautilus and other applications which asks if you want to run the file or open it. If not checked, the file will open without the query.
- Permit executables to change user/group identity. suid/nosuid Relates to scripts. Note: If you need to know about this, you probably don't need PySDM!
- Interpret character or special block devices. dev/nodev See note in previous entry!
- Journaling (Linux partitions only)
- Specify a journaling mode. /data= Ordered, journal or writeback.
- Update journal or specify the inode where it is. journal=
- Do not load journal on mounting. noload
This section deals with recording data access times and synchronization matters. User input is not normally required. Many items apply to linux partitions only.
- Update directory time for each access. diratime/nodiratime
- I/O to file system should be done synchronously. async/sync
- All directory updates should be done synchronously . nodirsync/dirsync
- Update file time for each access. atime/noatime
- Specify what to do in case of errors=. remount-ro/continue/panic Really, panic is an option..
- Do not attach buffer_heads to file pagecache.
- Get group id from the directory for a new file.
- Synchronize data and metadata every specified seconds. commit=
- Use a especific block as superblock. sb=
- Use old new inode allocator.
This section deals with network file systems, default character encoding, UFT-8 file name conversion, upper/lower case interpretation, and escape sequences. The default character set is the older iso8859-1. If your system is having trouble reading the directory or file names, changing these settings may help.
- File system requires network. _netdev
Linux partitions (ext2/ext3) only:
- User allowed to use reserved space. resuid=
- Group allowed to use reserved space. resgid=
- Support POSIX access list.
- Disables 32 bit user and group id.
- Print debugging info.
- Minix behavior for stat information.
- * Character set to use for file names. nls=iso8859-1 The english-speaking standard of iso8859-1 is the default and checked, The mount man page uses the iocharset=8859-1 . If this is listed in the Options window, I recommend changing nls= to iocharset= I personally turn it off by deselecting it..
- * Use UTF-8 for converting file names. utf8 Select this for ntfs and vfat (fat16/32) partitions.
- Update file time for each access. posix
- Use escape sequences for unknown characters. uni_xlate=
- Mount Button
You can mount and unmount the selected partition by clicking on this button. Cycling Unmount > Mount will allow the options you have designated to take effect. It is equivalent to running the 'sudo umount' and 'sudo mount' commands on the particular partition.
- Apply Button
Finallly! Clicking this button applies the changes. In fstab, the revised or new entries are placed at the bottom of the file. PySDM at present does not use UUID's or LABEL designations. If you have entries in fstab that use either of these designations, they will either remain unchanged or become comments. The '/dev/sdXX' line generated by PySDM will appear below previous entries in the /etc/fstab file. In this case, even though there are multiple entries for the same partition, the PySDM lines will be loaded last and thus will take precedence over earlier lines.
Dynamic Configuration Rules
This section enables you to set udev rules. Click on the 'New' button and you can set the conditions of Name, Model, Vendor, and bus type.
After setting specifications to identify the device, you can set the user, group, device file name, and specify user's rights. You can also create a link with a name of your choosing. The settings are stored in /etc/udev/user.rules. For more information about udev configuration refer to the man page ( man udev) or the link at the bottom of this guide.
4. When You Will Need Fstab (and How to Do It)
While PySDM offers an easy and safe way to change or create partition mounting instructions, there are several reasons why you might wish to edit fstab manually. Before modifying any system file, it is good practice to make a backup copy.
Code:sudo cp /etc/fstab /etc/fstab.bak gksu gedit /etc/fstab
- Refer to the instructions in the '3 Minute Guide' Removable Drives section for how to make the following changes.
- UUIDs. PySDM currently does not use UUIDs. If your fstab contains a UUID entry and you attempt to create a new listing for the same partition PySDM will create a "/dev/sdXX" entry at the bottom of the file. PySDM will either place a comment (#) symbol at the start of the original line and/or will override the UUID entry by placing the PySDM-generated entry at the bottom of fstab. A technique if you would like to retain the UUID entry would be to generate an fstab entry with PySDM, copy the options to the UUID line, and then delete the remainder of the PySDM entry. Remember that since PySDM does not use UUIDs, it will not update them if they are changed due to repartitioning.
- LABELS. PySDM currently does not use labels. Read the previous entry on UUIDs. The same technique applies for labels.
- /dev Designations. Some users prefer not to use /dev designations. In the past some updates/upgrades changed the letter designations of partitions. Since Hardy now uses the /dev/sdXX designation, there should be no more unrequested changes from /dev/hdXX to /dev/sdXX or vice versa. If you don't want to use the /dev designations run PySDM and then replace the /dev/sdXX designation with the UUID or label. (see commands below for determining these)
- FSCK Entries. The last digit in an fstab entry is provides instructions for fsck (disk checking).
The last digit relays the following instructions to fsck:
0 - Do not check. (This should always be the setting for non-linux partitions.)
1 - Check first. (Root)
2 - Perform check with a lower priority than 1 (when running during the same session).
PySDM always creates a listing with the FSCK option set at '0'. If you want to change this you will need to edit fstab and change the setting.
5. Notes & Additional Information
How Do I Know Which Partition to Choose?
When adding a new device or after partitioning a drive, you may not be sure which partition you want to select. One method you can try is to watch the list as the device is plugged in. If it may be mounted, run "sudo umount -a". There will be some busy messages but it won't hurt anything. Then plug in the device and see if it mounts by watching the Partition List window to see if it appears. Normally PySDM will place this 'new' device at the bottom of the list, even if the letter designation is lower than some already displayed. You can use some of the commands listed later in this section to help you investigate your system's partition information. Some of the following characteristics may help you determine the partition:
- Size - Approximate size of the partition: df -h
- Formatting - Type of formatting: df -T | grep "/dev/"
- Bootable - Bootable Partitions: sudo fdisk -l | grep "*"
- View Everything - sudo fdisk -l && sudo blkid && df -Th && cat /etc/fstab && mount
'Unprivileged User' NTFS Errors
NTFS-3g was incorporated in Hardy and is enabled by default. Nevertheless, it is possible to get an error message when trying to mount an NTFS partition as a specific user. The error message is:
- Unprivileged user can not mount NTFS block devices using the external FUSE library. Either mount the volume as root, or rebuild NTFS-3G with integrated FUSE support and make it setuid root. Please see more information at http://ntfs-3g.org/support.html#unprivileged
To correct this condition:
Code:sudo chown root $(which ntfs-3g) sudo chmod 4755 $(which ntfs-3g)
6. Useful Partition Commands (Results in italics)
What partitions are currently mounted?
/dev/sda5 on / type ext3 (rw,errors=remount-ro)
What is contained in my fstab (to exclude commented lines, add [ | grep -v "#" ]?
# Entry for /dev/sda5 :
UUID=4d33bfe6 / ext3 defaults,errors=remount-ro 0 1
What is the UUID / LABEL of my partition?
sudo blkid -c /dev/null
/dev/sda1: UUID="CEECFF9EECFF7F51" TYPE="ntfs"
What partitions are on my computer (note the switch is a small L)?
sudo fdisk -l
/dev/sda5 * 2804 4078 10241406 83 Linux
How much space do I have on my partitions?
/dev/sda5 ext3 9.7G 3.9G 5.4G 42% /
How do I make a label for my NTFS partition? (Install ntfsprogs first)
sudo ntfslabel <device> <label>
sudo ntfslabel /dev/sda5 MYLABEL
How do I make a label for my ext2/3 partition? (Install e2fsprogs first)
sudo tune2fs -L <label> <dev>
sudo tune2fs -L MYLABEL /dev/sda5
How do I make a label for my fat32 partition?
Warning: This overwrites any data on the partition.
sudo mkfs.vfat -F32 -n <label> <device>
sudo mkfs.vfat -F 32 -n MYLABEL /dev/sda5
sudo mkfs.vfat -F32 -n /dev/sdc 1 usb.5
Ubuntu Community Related Links
Introduction to Fstab
RenameUSBDrive (Really - How to Label Any Format)
Understanding fstab How to edit & understand /etc/fstab Understanding & Using File Permissions
PyGTK Storage Device Manager
Writing udev Rules
For KDE users or those wishing to install the KDE dependencies, mountmanager is said to be a comparable application with more advanced features than PySDM. It is available in the "universe" repository.
What's With the Name PySDM?
PySDM runs a PyGTK graphical interface = py for the python wrapper and GTK for the Gimp Tool Kit.