Set vfat partitions on the USB flash drive to be automatically mounted to fc3HAL.

Source: Internet
Author: User
Article Title: Configure fc3HAL to automatically mount vfat partitions on the USB flash drive. Linux is a technology channel of the IT lab in China. Some basic categories including desktop applications, Linux system management, kernel research, embedded systems, and open source are part of the translation. For more information, see redhat magazine's first article on new features of fedora core 3.

Http://www.redhat.com/magazine/001nov04/features/fedoracore3/

Meet Fedora Core 3
By Warren Togami and Colin Charles

* Introduction
* Desktop Improvements
* Behind the Desktop
* NetworkManager
* International Language Input
* Multimedia and Fun
* GCC
* Faster Updates
* Common Gotchas in Fedora Core 3
* Looking Ahead
* About the Authors

I translated the document once, but firefox crashed when I opened another webpage in the background.
I have made a lot of comments. Let's talk about the general meaning.

FC3 new things, including gnome-2.8, kernel-2.6.9, gcc-3.4.2 and so on. (In this article, fat32, ntfs, mp3, nvidia, fonts, and other things that everyone cares about on the Forum will never become free software .) (All other releases will use redhat's contribution in linux development, not only one company will benefit. Even if you use other releases, most of the components are redhat works. What is the problem with fedora ?)

The main new content in fedora is plug-and-play for devices. This set is not apparent on the surface. It mainly consists of hotplug, udev, D-BUS, HAL, gamin components.
Hotplug is part of the kernel and automatically configures the kernel status when the device is inserted or pulled out. Udev is a part of hotplug and is responsible for maintaining the dynamic/dev directory so that the content of the/dev directory is consistent with the current system status. The D-BUS can send messages between applications, for example, to send messages connected to a printer to HAL. HAL can integrate information from multiple sources, including kernel messages, configuration files, and so on, and then operate based on the message of the D-BUS. Gamin is an improved File status monitoring program.
For example, insert a USB flash drive. Hotplug automatically loads the required modules, creates corresponding/dev/sda1 nodes in udev, and sends messages to HAL. After receiving the messages, HAL sends the messages according to the configuration file, it runs fstab-sync to modify fstab and creates/media sub-directories as Mount Points. After gamin detects a change in fstab, it notifies the desktop system. The desktop system creates a drive icon in the computer project.
When the USB flash drive is detached, the module is detached, the device file is deleted, the corresponding entries in fstab are deleted, and the Mount Points in the/media Directory are also deleted.
If you think that autofs or manual mount is simpler than this, you can use two USB flash drives at the same time to see which one is better.

This process is very useful and can be used by different devices. For example, after a music CD is put into the optical drive, HAL can start the playing program or rail capturing program. Another important purpose, as mentioned in redhat magazine's third phase, is NetworkManager. Users who use mobile wireless communication may frequently change their network connection methods. Only by using hotplug and hal to collaborate can they quickly respond and dynamically switch network configurations.

Gnome-2.8's improvements to gnome-2.6 are reflected in the file selection box. If you press any key, a simple search window will pop up, allowing you to quickly find the content you need. If you press the '/' key, the jump position box that is the same as pressing ctrl-l in nautilus will pop out.

Evolution-2.0 adopts SpamAssassin, which provides outstanding defense against spam. In addition, gpg and other very important functions are provided. As for the news function removed, it is more convenient to use firefox's dynamic bookmarks.

Forget the other ones.
It is recommended that you take a look at the content about fedora in redhat magazine. Some of them are wonderful!

Set the hal mount policy to enable automatic mounting of the USB flash drive.

Statement
Part of this article is reproduced and translated from the redhat website. This document complies with gnu fdl and can be freely modified only for the body part. parts other than the original part must be published at the time of re-release. The translator apologized for not notifying the author, but expressed no responsibility for the consequences of the misunderstanding.

Start of Text
Because the default fat32 File System character encoding in fc3 kernel is ascii, if the file name of the USB flash drive contains Chinese characters, the conversion may fail and the application will lose response. There are many specific performance types, such as desktop crashes and failure to unmount partitions during shutdown.

The solution is to use the Mount parameter according to the locale value of the language environment during mounting. If the UTF-8 is used, mount-o utf8 is used, and if it is GB *, mount-o iocharset = cp936 is used. However, the benefits of FC3 are lost when manual mounting is cumbersome. The correct solution is to add your own configuration file.

Code:
[yuan@jackycom ~/Desktop]$ cat /usr/share/hal/fdi/95userpolicy/storage-policy.fdi
  
 
   
      
         
    
     true
          
    
     true
          
    
     true
          
    
     true
       
       
         
    
     true
          
    
     true
          
    
     true
          
    
     true
       
     
 
As mentioned above, hal reads these storage policy configuration files when receiving a notification from the USB flash drive. When rewriting/etc/fstab, the data in the configuration file will be used to add all these mount_options to fstab.

How to test results
The method to test the effect is very simple, but do not rush into the USB flash drive, but should first run
Code:
service haldaemon restart
Then insert the USB flash drive. After a few seconds, the USB flash drive icon appears on the desktop. Look at your fstab. If this line is added
Code:
/dev/sda1               /media/YUAN             vfat    pamconsole,utf8,users,dmask=0,fmask=111,noatime,sync,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
So there is no problem. Maybe selinux has been disabled in your system, so the parameter is not so long. Access to the USB flash drive should not cause any errors.

Possible problems
If your language environment is gb2312, You need to modify the preceding configuration file slightly and change the utf8 that appears twice to iocharset = cp936.
Be careful about spelling errors in the configuration file
If haldaemon is suspended or crashed, haldaemon may not be restarted or even shut down. Run
Code:
chkconfig haldaemon onchkconfig messagebus onservice messagebus restartservice haldaemon restart
Command Repeatability
Do not manually modify/etc/fstab. All modifications will be discarded. Only the hal configuration file should be modified.
Because we only created a configuration file and restarted a service, the repeatability should be good. If the options in the configuration file conflict, it is said that the latter one will be used for reading, that is, 95 userpolicy will be read after 90 defaultpolicy?

Compatibility with other solutions
Autofs Modifies/etc/auto. misc and/etc/auto. master without conflict.
Manual mounting, or manual modification of/etc/fstab, will expire after restart, because haldaemon will take over the fstab file, unless the option unmanaged (?) is added to fstab (?)

How to roll back to the initial status
Because only one configuration file is added, you only need to delete it. In addition, it is best to run it once.
Code:
service haldaemon restart
Text ended

Postscript

The configuration file in this document is meaningless, because its main purpose is to add the utf8 option, and the new version of hal already contains this configuration. In addition, the new configuration file uses volume. fstype as the matching keyword, which is more universal and is still available when the USB flash drive is in another format. The Code is as follows, excerpted from the new 90 ultultpolicy/storage-policy.fdi
Code:
          
           
             
  
   true
            
 
So modeled on this file, modify the custom policy file/usr/share/hal/fdi/95 userpolicy/storage-policy.fdi as follows
Code:
  
 
   
      
         
            
               
      
       true
                
      
       true
                
      
       true
                
      
       true
              
           
        
     
 
Update:
In the new hal-0.50, the location of the configuration file has changed, so if you have done the settings above, you must, move/usr/share/hal/fdi/95 userpolicy to the policy subdirectory, that is, move it to the/usr/share/hal/fdi/policy/95 userpolicy directory.
If you haven't done any settings before, just create the/usr/share/hal/fdi/policy/95 userpolicy directory and copy the configuration file according to the above content.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.