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