1 概述
1.1 說明
parted用於對磁盤(或RAID磁盤)進行分區及管理,與fdisk分區工具相比,支持2TB以上的磁盤分區,而且容許調整分區的大小
2 分區
交互式進行分區
[root@localhost ~]# parted /dev/sda //進入parted分區工具
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt //把sda改爲gpt大分區格式 ;定義分區表格式(經常使用的有msdos和gpt分區表格式,msdos不支持2TB以上的容量的磁盤,因此大於2TB的磁盤選gpt分區表格式) Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
(parted) print //進行查看 ,能夠看到已經打上了gpt的標籤
Model: DELL PERC H710P (scsi)
Disk /dev/sda: 4000GB
Sector size (logical/physical): 512B/512B
Partition Table: gptnode
Number Start End Size File system Name Flagside
(parted) mkpart primary 0 4000GB //建立一個主分區,容量從0GB開始到4000GB的所有空間
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) print //查看分區的信息
Model: DELL PERC H710P (scsi)
Disk /dev/sda: 4000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt工具
Number Start End Size File system Name Flags
1 17.4kB 4000GB 4000GB primaryui
(parted) quit
Information: You may need to update /etc/fstab.this
3 確認分區表的改變
partprobe /dev/sdb
使用partprobe則能夠使kernel從新讀取分區 信息,從而避免重啓系統orm
3.1 partprobe 選項說明
-d 不更新內核
-s 顯示磁盤分區彙總信息
-h 顯示幫助信息
-v 顯示版本信息ip
4 格式化(此格式化過程須要5分鐘左右)
[root@localhost ~]# mkfs.ext4 -F /dev/sda1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
244154368 inodes, 976617463 blocks
48830873 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
29804 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, 512000000, 550731776, 644972544it
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: doneio
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5 查看此磁盤的uuid,進行掛載table
#blkid /dev/sdb1 /dev/sdb1: UUID="120927fd-c132-4149-b78b-2148291c9287" TYPE="ext4" PARTLABEL="primary" PARTUUID="07220a37-50fb-47fa-803c-9ce648d6aa92" 而後使用uuid進行掛載