How to view all hard disk partitions, mounting NTFS disks, hard disks, and automatic mounting of hard disks in Linux

Source: Internet
Author: User
View hard disk partitions in Linux

In Linux, if you want to mount a hard disk, you must know the hard disk partition. How can this problem be solved? I am going to talk about two methods.
You can use "DF" or "DF-lH" to view the mounted partitions.

You can use "fdisk-L" to view the usage of all partitions and change the partitions!

You can also use cfdisk to view the usage of all partitions. Press Q to exit!

I think these methods are commonly used. Different systems can have different methods!

Fdisk-l view partition information
Mkdir/mnt/win create directory

Mount/dev/hda6 (depending on the situation)/mnt/win view the local fat Format hard disk (IDE Hard Disk)

Mount/dev/sda6 (depending on the situation)/mnt/win view the local fat Format hard disk (SATA hard disk)

Mount-t ntfs/dev/hda5 (depending on the situation)/mnt/win to view the NTFS hard disk of the Local Machine (the kernel may need to be re-compiled)

Mount-T snbfs-O username = *** // 192.168.2.2/shared/mnt/win view the hard disk of the machine on the network

CP-r/mnt/win/Solaris ../appsoft/Solaris COPY Command (r indicates recursively copying the entire directory)

Linux mounts NTFS disks for maintenance on the company's servers today. You need to back up some data. An NTFS mobile hard disk was taken in the past. When I arrived at the data center, I suddenly thought that the company's servers could not be directly mounted on the NTFS hard disk.
Therefore, you must provide support. I use a ntfs-3g. The file can be seen in the attachment. Put it down and then directly upload it to the server to install it in the Linux operating system. The installation process is very simple, that is,./configure & make install.
Then you need to find the device location of the NTFS hard disk, use the fdisk-l command to display all hard disk devices under the current system, find your NTFS device, and then mount it.
First, you need to set up the mount point. I did this, mkdir/Media/udisk. Then mount,
Mount-T ntfs-3g device/Media/udisk,
Example: Mount-T ntfs-3g/dev/sdb1/Media/udisk
Finally, you can access your files under udisk.
Detach a hard disk device.
Umount/Media/udisk or umount/dev/sdb1 OK!
# Tar-zxvf fuse-2.7.0.tar.gz
# Cd fuse-2.7.0
#./Configure
# Make
# Make install
# Lsmod
# Modprobe Fuse

Then (re) configure and install ntfs-3g

# Tar-zxvf ntfs-3g-1.5130.tar.gz
# Cd ntfs-3g-1.5130
#./Configure -- enable-fuse-Module
# Make
# Make install

Then mount your NTFS drive in Linux.

# Mkdir/mnt/Windows
# Mount-T ntfs-3g/dev/sda1/mnt/Windows

Now, you can read/write NTFS formatted drive in Linux. Hard Disk mounting automatically when Linux is started

Basically, all Linux distributions Mount partitions when starting the system according to the/etc/fstab file configuration. In/etc/fstab, the mount parameters are also different for partitions in different formats, and the results are different for different parameters, including the user's read and write permissions.

1. For FAT32 format partitions, add the following content to/etc/fstab:

/Dev/sdax/Media/y vfat user, RW, utf8, umask = 000 0 0

Note: The/dev/sdax command fdisk-l can be used as an administrator to find the partition you want to mount. /Media/y this is a folder and should be created in advance ." User, RW "indicates that users can perform read and write operations. Utf8 is necessary because some Windows folders are often named in Chinese, while GBK encoding is used in windows. garbled characters are displayed when the folders are mounted in Linux, the utf8 parameter is used to automatically convert Chinese characters to utf8 display, which can effectively avoid garbled characters. Umask = 000 indicates that all users are granted read/write operations, that is, after mounting, the common user can
. At last, two zeros are separated by spaces. The latter of the two zeros determines whether to check the power-on. If yes, change it to 1.

2. For LINUX partition formats such as ext3 and ext4, you can add the following content to/etc/fstab:

/Dev/sdax/Media/y ext3 defaults 0 1/dev/sdax/Media/y ext4 defaults 0 1/dev/sdax/Media/y JFS defaults 0 1 ......

The above lines correspond to the mounting statements of ext3, ext4, and JFS respectively. Modify the statements based on your own partition conditions. In these statements, the meaning of X and Y is the same as that of Y. The default parameter is mounted in the default format, and the following 0 and 1 indicate that the system should be checked upon startup.

3, NTFS format partition, more trouble, first install ntfs-3g this software, if you do not install this software will not be able to read and write NTFS format partition. After installation, add the following content to/etc/fstab:

/Dev/sdax/Media/y ntfs-3g defaults 0 0

PS: I used the/dev/sdax/Media/y auto defaults 0 0

Here the meaning of X and Y is the same as above, it is worth noting that the parameters after the ntfs-3g are as follows:

  • Users-If SUID root is set in the ntfs-3g Executable File(Command:Ntfs-3g/chmod U + S/bin/)Allows anyone to mount/detach an NTFS partition. Note:UsersInsteadUser
  • UID-Specify the owner of the files and directories in the NTFS partition (expressed in decimal number)
  • GID-Specify the user group of files and directories in the NTFS partition (expressed in decimal number)
  • Fmask-File Permission (octal mask)
  • Dmask-Directory permission (octal mask)
  • Locale-Used to make files using international character sets visible. It is no longer required in ntfs-3g 2009.1.1 and the updated version.
  • Noauto-Do not automatically mount partitions when starting.

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.