Mount and detach a hard disk from centos

Source: Internet
Author: User
Fdisk-l // first query unmounted hard disk names such as mkfs such as sdb1. ext3/dev/xvdb start to format DF-H Mount/dev/xvdb/home start to mount VI/etc/fstab settings automatically enable start to add/dev/xvdb/home ext3 defaults 0 by format 0 hard disk name: mount point to be mounted in the format: umount/home/ftp2

 

1. view the new Hard Disk

# Fdisk-l

The number of the newly added hard disk is/dev/sdb.

2. Hard Disk partitioning

1) enter the fdisk Mode

# Fdisk/dev/SDB

2) Input n to partition

3) Select the partition type

There are two options:
? P: a maximum of four primary partitions can be created in Linux.
? E: there can be only one extended partition in Linux. After the extended partition is created, it cannot be used directly. You must also create a logical partition in the extended partition.
Select P here.

4) Select the number of partitions

Enter 1 for only one partition, and then set the cylinder. The default value is enough.

5) Input W to write data to the partition table and the partition ends.

View the/dev directory after the partition is complete.

# Ls-L/dev

We can see the newly generated partition sdb1.

3. format the partition

Format the new partition as an ext3 file system.
# Mkfs-T ext3/dev/sdb1

Finally, write the file system information.
Now you can use the newly created partition.
4. Attach a hard disk
1) create a mount point
Create a storage directory under the root directory
# Mkdir/storage
2) Mount/dev/sdb1 to/storage
# Mount/dev/sdb1/storage
5. Set automatic mounting upon startup
The newly created partition cannot be automatically mounted upon startup. Manual mounting is required each time the machine is restarted.
Modify the/etc/fstab file to set automatic mounting upon startup.
# Vi/etc/fstab
Add a line at the end of the file

/Dev/sdb1/storage ext3 defaults 1 2

Mount and detach a hard disk from centos

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.