Linux Add, remove HDD mount/unmount

Source: Internet
Author: User

1. Create new partition command with new hard disk Fdisk

Command parameters

A: command to specify the boot partition; d: command to delete an existing partition; L: command to display a list of partition ID numbers; M: view fdisk command help; N: command to create a new partition; P: command to display a partition list; t: command to modify the type ID number of the partition; W: The command is to save changes to the partition table to make it work. Fdisk/dev/sdb command (M for help): N command Action E extended//input E for creating extended partition P primary partition (1-4) P partion Number (1-4): 1 Command (M for help): W input n Enter, and then enter P return, and then output 1 return to the car, all the way back, and finally enter the W to save. Check: Fdisk-l can see/DEV/SDB1 partition 2, format the newly created partition
Format the new partition as a ext3 file system
1) If you are creating a primary partition
#mkfs-T EXT3/DEV/SDB1 3, mount the hard drive (personal understanding is to connect the new partition with the directory we use) 1) Create a mount point
Create the Data1 directory under the root directory
#mkdir/data1
2) mount the/DEV/SDB1 to the/DATA1
#mount/dev/sdb1/data1

By the way, the basic usage of Mount:

Format: Mount [-parameter] [device name] [Mount Point]
Among the parameters commonly used are:
-A installs all file systems that are class-out in the/etc/fstab file.
-F disguises mount, making checks on the device and the directory look, but does not really mount the file system.
-N does not record the installation in the/etc/mtab file.
-R tells the file system to be installed as read-only.
-V Displays the installation information in detail.
-W installs the file system as writable, default for the command

Note that the mount point must be a directory that already exists, this directory may not be empty, but the previous contents of this directory will not be available after mounting, Umount will return to normal later.

Like what:

Mkdir/data1

Mount/dev/sdb1/data1

For more details on Mount, refer to Http://www.cnblogs.com/qq78292959/archive/2012/03/06/2382334.html

5, set the boot automatically mount
The newly created partition cannot be mounted automatically and will be mounted manually each time the machine is restarted.
Set boot auto mount requires modification of/etc/fstab file
#vi/etc/fstab
Add a line at the end of the file
/dev/sdb1/data1 ext3 Defaults 1 2

Linux Add, remove HDD mount/unmount

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.