在内网主机CentOS 6.5新增一个2T硬盘,先关机断电再连接硬盘数据线和电源线。

查看当前磁盘设备信息:

[root@linuxidc ~]# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1      19458  156290903+  ee  GPT

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

格式化/dev/sda

[root@linuxidc ~]# mkfs.ext4 /dev/sda
mke2fs 1.41.12 (17-May-2010)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=1 blocks, Stripe width=0 blocks
122101760 inodes, 488378646 blocks
24418932 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
14905 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
   32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
   4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
   102400000, 214990848

Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

新建目录并挂载
[root@linuxidc ~]# mkdir /wdc
[root@linuxidc ~]# mount /dev/sda /wdc

[root@linuxidc ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb4        50G  8.2G  39G  18% /
tmpfs          1.9G    0  1.9G  0% /dev/shm
/dev/sdb2      194M  47M  138M  26% /boot
/dev/sdb1      799M  264K  799M  1% /boot/efi
/dev/sdb3        97G  4.1G  88G  5% /data
/dev/sda        1.8T  196M  1.7T  1% /wdc


设置开机时自动挂载:

查看磁盘UUID信息

[root@linuxidc /]# blkid
/dev/sdb1: UUID="2824-9F12" TYPE="vfat" 
/dev/sdb2: UUID="95a58d28-583f-4bd2-a1b8-5217603ab169" TYPE="ext4" 
/dev/sdb3: UUID="1576184b-a5fd-436e-9f0a-f1d017976a9b" TYPE="ext4" 
/dev/sdb4: UUID="6a85e17b-aba8-4547-a915-013dec8665f5" TYPE="ext4" 
/dev/sda: UUID="d03dad1a-797d-47a5-92c8-5ec5836d35e2" TYPE="ext4" 
[root@linuxidc /]# vim /etc/fstab

添加以下信息
UUID=d03dad1a-797d-47a5-92c8-5ec5836d35e2  /wdc  ext4    defaults 0 0

编辑后的信息如下:
#
# /etc/fstab
# Created by anaconda on Mon Oct 17 12:29:32 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=6a85e17b-aba8-4547-a915-013dec8665f5 /                      ext4    defaults        1 1
UUID=95a58d28-583f-4bd2-a1b8-5217603ab169 /boot                  ext4    defaults        1 2
UUID=2824-9F12          /boot/efi              vfat    umask=0077,shortname=winnt 0 0
UUID=1576184b-a5fd-436e-9f0a-f1d017976a9b /data                  ext4    defaults        1 2
UUID=d03dad1a-797d-47a5-92c8-5ec5836d35e2  /wdc                  ext4    defaults        0 0
tmpfs                  /dev/shm                tmpfs  defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                  /sys                    sysfs  defaults        0 0
proc                    /proc                  proc    defaults        0 0

本文永久更新链接地址http://www.linuxidc.com/Linux/2017-06/144991.htm