当磁盘大于2T时,是无法使用fdisk分2T以上的分区的。例如:/dev/sdb 有8T,使用fdisk /dev/sdb 进行分区,依次输入p 1 enter enter w q .格式化挂载,如图:
以下使用parted进行分区:
1.新加了一盘硬盘,使用100M代替8T硬盘
[root@www ~]# fdisk -l #没有发现我新添加的硬盘 Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders …………
2.需要重新扫描总线
[root@www ~]# echo "- - -" > /sys/class/scsi_host/host2/scan [root@www ~]# fdisk -l /dev/sdj #新加的硬盘 Disk /dev/sdj: 106 MB, 106954752 bytes 64 heads, 32 sectors/track, 102 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
3.使用parted进行分区
[root@www ~]# parted /dev/sdj GNU Parted 2.1 使用 /dev/sdj Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) help #交互式获得帮助 align-check TYPE N check partition N for TYPE(min|opt) alignment check NUMBER do a simple check on the file system cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system move NUMBER START END move partition NUMBER name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition quit exit program rescue START END rescue a lost partition near START and END resize NUMBER START END resize partition NUMBER and its file system rm NUMBER delete partition NUMBER select DEVICE choose the device to edit set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted (parted) mklabel gpt #先将磁盘结构改为gpt 警告: The existing disk label on /dev/sdj will be destroyed and all data on this disk will be lost. Do you want to continue? 是/Yes/否/No? yes (parted) mkpart #分区第一种方式 分区名称? []? primary 文件系统类型? [ext2]? ext4 起始点? 1 结束点? 10 (parted) mkpart primary 11 20 #分区第2中方式 警告: The resulting partition is not properly aligned for best performance. 忽略/Ignore/放弃/Cancel? ignore (parted) p #打印分区列表 Model: VMware, VMware Virtual S (scsi) Disk /dev/sdj: 107MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name 标志 1 1049kB 10.5MB 9437kB primary 2 11.0MB 20.0MB 9000kB primary (parted) q 信息: You may need to update /etc/fstab. [root@www ~]# [root@www ~]# parted /dev/sdj mkpart logic 21 30 #非交互式分区 信息: You may need to update /etc/fstab. [root@www ~]# ll /dev/sdj* brw-rw---- 1 root disk 8, 144 9月 5 04:32 /dev/sdj brw-rw---- 1 root disk 8, 145 9月 5 04:32 /dev/sdj1 brw-rw---- 1 root disk 8, 146 9月 5 04:32 /dev/sdj2 brw-rw---- 1 root disk 8, 147 9月 5 04:32 /dev/sdj3 #非交互新加硬盘 [root@www ~]#
4.格式化分区
[root@www ~]# mkfs.ext4 /dev/sdj1 mke2fs 1.41.12 (17-May-2010) 文件系统标签= 操作系统:Linux 块大小=1024 (log=0) 分块大小=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 2304 inodes, 9216 blocks 460 blocks (4.99%) reserved for the super user 第一个数据块=1 Maximum filesystem blocks=9437184 2 block groups 8192 blocks per group, 8192 fragments per group 1152 inodes per group Superblock backups stored on blocks: 8193 正在写入inode表: 完成 Creating journal (1024 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 This filesystem will be automatically checked every 37 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@www ~]# mkdir /biluochun [root@www ~]# mount -t ext4 /dev/sdj1 /biluochun [root@www ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda5 8.0G 2.2G 5.4G 29% / tmpfs 937M 0 937M 0% /dev/shm /dev/sda1 194M 27M 158M 15% /boot /dev/sda2 9.7G 1.5G 7.7G 17% /usr /dev/sdc4 99M 23M 72M 24% /home /dev/md127 197M 5.8M 181M 4% /data /dev/sr0 4.2G 4.2G 0 100% /mnt /dev/sdj1 8.8M 1.1M 7.2M 14% /biluochun [root@www ~]#