Set up Linux boot automatically mount hard drive __linux

Source: Internet
Author: User
Tags uuid

The machine is mounted on two hard drive items have files to be written in the Mount directory, so need to boot mount, Google a bit, the original is easy AH

Refer to this article

When using multiple solid-state drives on a Linux system, by default only mount the system disk, to use the other disk, we need to mount the hard drive, the following is a brief introduction, I am on the new hard disk operation method.
To view a hard drive in the system that is not mounted
sudo hdparm-i/dev/sdb hard disk hardware installation, this command tests whether the Linux system can find the mounted unpartitioned hard drive.
Since we do not need partitions here, we do not have to partition the operation.
Format the hard drive
Use the command sudo mkfs-t ext3/dev/sdb1/dev/sdb1 as a descriptor for the new hard drive on Linux. The new hard disk partition created above is formatted into EXT3 format, which will wait for a while to end automatically.
Set the volume label for a new hard disk
sudo e2label/dev/sdb1/code/code is the name under the root directory of the/DEV/SDB1 new hard drive
Set mount point
sudo mkdir/code//Create mount point under root path
Set up automatic mount
Use the command sudo vim/etc/fstab to edit the file, and the file's configuration list is as follows:

File system mount point type options Dump Pass
A b c d E F

A refers to the device name of the file system. Initially, the field contains only the device names (such as/DEV/SDA1) for the partition to be mounted. Now, in addition to the device name, you can include a label or UUID
B file System mount point. The file system contains all the data in the entire directory tree structure under the mount point, unless one of the directories mounts another file system
C file system type. The following are the most common file system types (EXT3,TMPFS,DEVPTS,SYSFS,PROC,SWAP,VFAT)
D mount command options. The Mount option includes Noauto (which does not mount the file system on startup) and RO (read-only mount file system), and so on. Add a user or Owner option to this field to allow the user to mount the file system. Multiple options must be separated by commas. Information about other options is available in the Mount Command man page (---o option)
E dump file system. This field only makes sense when you are backing up with a dump. The number 1 indicates that the file system requires a dump, and 0 does not need to dump the
F file system check. The number in the field indicates whether the file system needs to be checked with fsck. 0 means that the file system does not have to be checked, and the number 1 indicates that the filesystem needs to be checked in advance (for the root file system). The number 2 indicates that after the root file system check is completed, the file system is checked again
we need to write the configuration to the file in the format above, note that each tab is used to separate each other, our configuration information is as follows:
/dev/sdb1/code ext3 defaults 1 2/DEV/SDB1 The identifier for the hard disk
and then remember to save the file.
Reboot to see if mount successful
use the df-h command to view the partition space usage, and you can see that the/code is automatically mounted. The results of the view are as follows:

FileSystem Size Used Avail use% mounted on
/DEV/SDA1 139G 121G 12G 92%/
Varrun 1.3G 68K 1.3G 1%/var/run
Varlock 1.3G 0 1.3G 0%/var/lock
Udev 1.3G 32K 1.3G 1%/dev
Devshm 1.3G 0 1.3G 0%/dev/shm
/DEV/SDB1 924G 11G 867G 2%/code
Seeing our/code is already on the top, it's done.
Reference Address http://www.cnblogs.com/avril/archive/2010/03/23/1692783.html

Description
Fdisk-l view hard disk partition information

How to partition format reference previous article

#/etc/fstab:static file system information.
# use
' Blkid ' to print the universally unique identifier for a
# device, this May is used with uuid= as a more R Obust Way to name devices
# This works even if disks are added and removed. Fstab (5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass >
#/was ON/DEV/SDC1 during installation
uuid=751cd843-5686-4af7-a538-38b022670464/               ext4    Errors=remount-ro 0       1
# Swap was ON/DEV/SDC5 during installation
uuid= cdc94d0b-ead4-461e-a38f-9505b1d79620 none            swap    SW              0       0
adds the following Line Note tab-separated
/dev/sda1       /data   ext3    defaults        1       2
/dev/sdb1       /backup ext3    defaults        1       2
~                                                             

Set the volume label for a new hard disk

E2label   /dev/sda1    /data   
 e2label   /dev/sdb1    /backup

Sudo e2label/dev/sda1/data/data is the name of the/dev/sda1 new hard drive root directory

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.