1、查看分区
# fdisk -l //查看现有硬盘及分区 /dev/sdb就是新的3TB硬盘 。
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 3324.3 GB, 3324304687104 bytes
255 heads, 63 sectors/track, 404157 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
2、分区
# parted /dev/sdb //为/dev/sdb硬盘分区
GNU Parted 1.8.1
使用 /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt //硬盘转换为GPT
(parted) mkpart //创建分区
分区名称? []? //直接回车
文件系统类型? [ext2]? //直接回车,也可以输入ext3或者xfs等格式
起始点? 0 //分区开始
结束点? -1 //分区结束 -1为全部硬盘空间
(parted) p //查看分区结果
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 3324GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name 标志
1 17.4kB 3324GB 3324GB
(parted) quit //退出
# fdisk -l //查看现有分区及硬盘 /dev/sdb1 就是新的3TB分区 分区表为 EFI GPT。
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
WARNING: The size of this disk is 3.3 TB (3324304687104 bytes).
DOS partition table format can not be used on drives for volumes
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID
partition table format (GPT).
Disk /dev/sdb: 3324.3 GB, 3324304687104 bytes
255 heads, 63 sectors/track, 404157 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 267350 2147483647+ ee EFI GPT
3、格式化
# mkfs -t ext4 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
405798912 inodes, 811597575 blocks
40579878 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
24768 block groups
32768 blocks per group, 32768 fragments per group
16384 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, 512000000, 550731776, 644972544
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
4、挂载
# mkdir /test //创建目录 /test。
# mount /dev/sdb1 /test //把分区挂载到 /test上。
# df -h //查看已挂载的目录。
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
15G 3.0G 11G 22% /
/dev/sda1 99M 13M 82M 13% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sdb1 3.0T 200M 2.9T 1% /test //已经成功能挂载了。3TB