Linux newbie tutorial: teach you how to mount the hard disk

  

mount Windows partition

1. Manual mount
can also read Windows partition in Linux, including fat32 format and ntfs format of. First of all, you have to know the name of the hard disk partition under Linux. For example, the C drive under Windows is usually hda1, the D drive is hda5, the E drive is hda6, and so on. Please see the related documentation for details.

To mount a Windows partition, you must first determine the locale of the Linux system you are using (this locale includes information such as the language and character encoding used by the system). The common locales for 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 MandrivaLinux 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, otherwise there will be a lot of garbled situations. To view the locale of the system, you can enter the following command in the terminal to view:

echo $LANG

Second, you have to know the format of your windows partition, the properties of this partition in windows Can be seen, generally in the format of fat32 and ntfs.

Assuming your locale is zh_CN.UTF-8, you want to mount a /dev/hda1 fat32 format windows partition to the /mnt/C directory (if this directory does not exist manually), you can Enter the following command under the terminal (you also need to add sudo before this line 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.

This mounts the ntfs format partition, only root can read, if you need to allow ordinary users to read, you need to add 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 allow all users to read and modify, you can change the above umask=022 to Umask=0 is fine.

Uninstalling the partition is much simpler:
umount /dev/hda1

Sometimes when the partition is unloaded, the partition is busy (device is busy). You can use the following command to see which one? The process is using this partition:
fuser -cu /dev/hda1

If the output of the screen is
/dev/hda1: 8463m(cck)

then this command can be used. Look at the program name corresponding to this process:
ps 8463

Then you can use this command to end this process:
kill -9 8463

This will normally uninstall the partition.

2. Automount
To automatically mount the windows partition when the Linux system starts, 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,umask=022 0 0
/Dev/hda5 /mnt/D vfat utf8,umask=0 0 0

Copyright © Windows knowledge All Rights Reserved