Shell script Real-Combat notes (4)--linux disk partition re-mount

Source: Internet
Author: User

Background:
The default specified file directory for Hadoop's HDFs file system mount is/mnt/disk{n}. When operators, accidentally attached to the disk in other directories, such as/mnt/data,/mnt/disk01,/mnt/diska, HDFs will select the root partition, when the data is poured into HDFs, the result is often the root partition is quickly consumed, and other partitions are not used.
In the CDH version, the configuration of HDFs is as follows:

Dfs.datanode.data.dir =/mnt/disk{n}/dfs/dndfs.datanode.data.dir.perm = 755

This shows: HDFs select/mnt/disk{n} as a storage directory for data for a reason

How is this handled? The essential solution to this problem is to re-mount the corresponding disk partition to/MNT/DISKN by editing the fstab and restarting.

Solution:
1. Using the Mount method
*) Create/mnt/disk{n}
Mdkir-p/mnt/disk1
Mdkir-p/mnt/disk2
*) Mount/mnt/disk{n}
Mount/dev/sdb2/mnt/disk1
Mount/dev/sdc1/mnt/disk2

The disks after mount are as follows:

[Email protected]:~ # df-h file system capacity used available% mount point/dev/sda1 459G 358G 100G 79%/devtmpfs 32G 188K 32G 1%/devtmpfs 32G 104K 32G 1%/dev/shm/dev/sdb2 457G 320G 136G 71%/mnt/disk1/dev/sdc1 459G 289G 147G 67%/mnt/disk2

However, the use of mount to solve a temporary problem, but after the restart, the previous mount information is lost.

2. Using the fstab approach
*) Edit/etc/fstab

# <file system> <mount point> <type> <options> <dump> <pass>/dev/sdb2/mnt/disk1 ext3 defaults 0 0/dev/sdc1/mnt/disk2 ext3 defaults 0 0

*) to mount the test

Mount-a
echo $?
Mount-a no output, and echo $? The return result is 0, which means the/etc/fstab configuration is fine

*) System restart
Reboot

Related content:
1. How to view information such as disk partitioning
Fdisk-l
ls/dev/sd*
2. Meaning of the configuration item in/etc/fstab
<file system> <mount point> <type> <options> <dump> <pass>
<file system>: Device name or device volume label name
<mount Point>: Device mount Directory
<TYPE>: Equipment file system, VFAT, Ext3, EXT4, swap, etc.
<OPTIONS>: Mount parameter, can choose defaults
<dump>: Indicates whether to back up. (0 is not backup, 1 is to be backed up, general root partition to be backed up)
<pass>: Indicates the self-test order. (0 is not self-test, 1 or 2 is to self-test, if the root partition to be set to 1, the other partition can only be 2)

/dev/sdb2/mnt/disk1 ext3 defaults 0 0
/dev/sdc1/mnt/disk2 ext3 defaults 0 0

Reference Links:
Http://blog.sina.com.cn/s/blog_6ce9e88701014jgl.html
Http://www.shangxueba.com/jingyan/121709.html

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.