1. Add a hard drive to the server
Note:
If you are IDE interface hard disk: / dev / dh [az] , where the name of the hard disk should be the beginning dh [az]
if you are a SCSI interface hard disk: / dev / [a -z] , there should be a hard name beginning sd [az], our new hard drive is sdb
2. Use df -h to view information on the computer hard disk (HDD not we add)
2. Use fdisk -l View all the computer disk information, including disk is not loaded
You can see we add 10G disk exists, but is not loaded, the system does not recognize
3. Use lsblk check which disk and partition to load
You can see sdb size 10G, only one disk (disk) and no zoning
4. fdisk to partition the hard drive (or less while the hard disk 2T, using fdisk, greater than 2T, with parted)
fdisk /dev/sdb
Press m to display the menu (menu):
Select the n- (the Add A new new Partition, create a new partition)
We are the first established, there is no primary partition, so I chose to build p primary partition
Next let you choose the partition number, because the primary partition only four partitions, we choose the default 1
Followed by the start sector and the end sector, start sector the default, the input end sector partition size +
The first partition has been established at this time, but still not written in memory and hard disk sdb, the so direct input w
Note that you can continue to create a partition, enter w over again, I am here only to build a partition
After the above steps have been completed to establish a partition, but this time the system can not recognize the partition table
5. Use partprobe kernel reread the partition table
partprobe / dev / sdb
Note: Here is the entire disk sdb, not a partition sdb1
6. Use mkfs to create a filesystem (format the partition)
The mainstream Linux file system: ext4 and xfsd etc., where I built ext4 file system.
mkfs.ext4 /dev/sdb1
(Note: This is the disk partition sdb1, not the entire disk sdb)
7. Use mkdir to create a directory to mount
mkdir /mnt/sdb1_newdisk
Before you mount the need to determine the mount directory, I have here is / mnt / sdb1_newdisk, here is best built on the directory / mnt, this directory is designed to mount.
8. mount temporary mount directory
mount / dev / sdb1 / mnt / sdb1_newdisk /
Here it has been mounted successfully, but this is just a one-time, after the restart will disappear.
9. Edit / etc / fstab permanent mount directory
vim /etc/fstab
/ etc / fstab each column have the following meanings
硬盘路径 文件路径(挂载点) 文件系统类型 设备的自定义选项 是否转存 fsck的顺序
/dev/mapper/CentOS-root / xfs defaults 0 0
我们要在最后一行写入自己的分区与文件路径,可以仿照上面的写
/dev/sdb1 /mnt/sdb1_newdisk ext4 defaults 0 0
Dump: 0 not dump, a dump is not backed up, backup
the fsck: disk boot check sequence 1234 .... 0 means no check of the inspection order
Here you can also write the first column UUID (using blkid query UUID)
10. Use mount -a determined load is correct
If no other message, that you insert the correct or wrong.
If there is no error checking and, after boot into emergency mode, can not boot
after the last power-on reset df -h to see if normal
11. When the hard disk is greater than 2T, using fdisk -l have the WARING .
root@greatms-All-Series:/home/share# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = 扇区 of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000aab9b
Equipment starting point for launching several end block Id System
/ dev / sda1 * 2048 488 282 111 244 140 032 83 Linux
/ dev / sda2 488 284 158 976 771 071 244 243 457 5 Extended
Partition 2 does not Start ON PHYSICAL a SECTOR boundary.
/ Dev / sda5 488.28416 million 820 314 111 166 014 976 83 Linux
/ dev / sda6 820316160 976771071 78227456 82 Linux swap / Solaris
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
(/ dev / sdb is larger than 2T), above the alert said that fdisk does not support the partition, use the parted partition.
Disk / dev / sdb: 3000.6 GB, 3000592982016 bytes
255 Heads, 63 sectors / Track, 364 801 Cylinders, Total 5860533168 sectors
Units = sectors area * 512 = 512. 1 of bytes
Sector size (Logical / PHYSICAL): 512 bytes / 4096 bytes
the I / O size (Minimum / Optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
The number of blocks starting end device starts Id System
/ dev / sdb1 1 4294967295 2147483647+ ee GPT (fdisk -l showed a primary partition, but in fact does not exist, can be used mkfs.ext4 / dev / sdb1 test, the partition will be reported does not exist, can not find the partition)
partition 1 does not Start a SECTOR ON PHYSICAL boundary.
12. Use parted partition a hard disk larger than 2T
the parted / dev / SDB (for 3T partition the drive processing part command)
mklabel gpt (may 3TB get used gpt format a partition)
Unit the TB (set in units of the TB)
the mkpart Primary 0. 3 (set as a primary partition, size is 3TB, initially 0, ending 3)
Primary 3. 6 the mkpart (re-set to a primary partition, the size of 3TB, 3 is started, is the end. 6)
Print (partition size display settings)
quit (abort parted program)
Format the partition as ext4 format
mkfs.ext4 /dev/sdb1
The hard disk mount folder
1, manually mount.
Create a new folder: mkdir / Home / sdb1
Mount: Mount / dev / sdb1 / Home / sdb1
2, boot automatically mount.
vi / etc / fstab
added at the end:
/dev/sdb1 /home/sdb1 ext4 defaults 1 1