Attaching a CentOS disk to a hard disk and mounting it automatically upon startup

Source: Internet
Author: User

Attaching a CentOS disk to a hard disk and mounting it automatically upon startup

1. First, find the link to the hard disk:

Fdisk-l

2. Next, partition the hard disk.

Fdisk/dev/sdc press ENTER

Enter n, p, 1, and press ENTER twice, and then wq as prompted.

3. view the partitioned disk sdc1

Fdisk-l

4. format the partitioned Disk

Mkfs-t ext4/dev/sdc1

5. Mount after formatting

Mkdir-p/mnt/sdc & mount-t ext4/dev/sdc1/mnt/sdc

6. Check the disk size in mnt/sdc.

(1) view the file or folder size

View the size of all files in the current folder (including sub-files du-sh)

View All file sizes (including subfolders) in a specified folder du-h ftp

View the size of the specified file du-h./package/compat-libstdc ++-33-3.2.3-69.el6.x86_64.rpm

(2) command df-l to view disk space

Df-hl view the remaining disk space

Df-h: view the partition size of each root path

Du-sh [directory name] returns the directory size

Du-sm [Folder] returns the total number of MB in this folder.

7. automatic mounting upon startup

If UUID is used, run the "blkid/dev/sdc1" command to obtain the disk UUID,

/Dev/sdc1: UUID = "185dc58b-3f12-4e90-952e-7acfa3e0b6fb"
Then, in/etc/fstab, add:

UUID = 185dc58b-3f12-4e90-952e-7acfa3e0b6fb/mnt/mydisk ext4 defaults 0 2

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.