Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Manual and automatic mounting methods of hard disk under Linux operating system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "manual and automatic mounting of hard drives under the Linux operating system". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Manual mount

Windows partitions, including fat32 format and ntfs format, can also be read in Linux. First of all, you need to know the name of hard disk partition under Linux. For example, C disk under Windows is usually hda1, D disk is hda5, E disk is hda6, and so on. Please refer to the relevant documentation for details.

To mount the Windows partition, you must first determine the locale of the Linux system you are using (this locale includes information such as the language used by the system and the encoding of characters). The locale commonly used in Chinese Linux are zh_CN.gb2312,zh_CN.gbk,zh_CN.gb18030 and zh_CN.UTF-8.

In the default installation, the locale for Debian Linux and Mandriva Linux is zh_CN.gb2312, and the locale for Ubuntu Linux and Fedora Linux is zh_CN.UTF-8. It is best not to change the locale casually, or there will be a lot of garbled. To view the locale of the system, enter the following command under the terminal:

Echo $LANG

Second, you need to know the format of your windows partition, which can be seen in the properties of the windows partition, usually in fat32 and ntfs formats.

Suppose your locale is zh_CN.UTF-8. To mount a windows partition in fat32 format of / dev/hda1 to the / mnt/C directory (if there is no manual creation of one in this directory), type the following command under the terminal (you also need to add sudo to this command in Ubuntu):

Mount-t vfat / dev/hda1 / mnt/C-o iocharset=utf8

If your locale is not zh_CN.UTF-8, change the utf8 of the above command to gb2312;. If the windows partition is in ntfs format, change the vfat of the above command to ntfs.

Only root can read the ntfs partition mounted in this way. If you need to allow ordinary users to read it, you need to add the umask=022 option, as follows:

Mount-t ntfs / dev/hda1 / mnt/C-o iocharset=utf8,umask=022

Similarly, if you want the mounted partition to be read and modified by all users, you can change the umask=022 above to umask=0.

Unloading a partition is much easier:

Umount / dev/hda1

Sometimes when uninstalling a partition prompts you that the partition is busy (device is busy), you can first use the following command to see which process is using the partition:

Fuser-cu / dev/hda1

If the output of the screen is

/ dev/hda1: 8463m (cck)

You can use this command to see the program name corresponding to this process:

Ps 8463

You can then end the process with this command:

Kill-9 8463

In this way, the partition can be unloaded normally.

two。 Automatic mount

To allow the Linux system to mount the windows partition automatically at startup, you can write the above command to the / etc/fstab file. Here is an example:

# / etc/fstab: static file system information.## [file system] [mount point] [type] [options] [dump] [pass] proc / proc proc defaults 0 0/dev/hda9 / ext3 defaults 0 1/dev/hda13 none swap sw 0 0/dev/hdc / media/cdrom iso9660 ro,user,noauto 0 0/dev/fd0 / media/floppy auto rw,user,noauto 0 0/dev/hda10 / mnt/debian ext3 defaults 0 0/dev/hda1 / mnt/C ntfs utf8 So much for the introduction of umask=022 0 0/dev/hda5 / mnt/D vfat utf8,umask=0 00 "Manual and automatic mounting methods of hard disk under Linux operating system". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report