========================================================
(1)既适用于gpt格式,又适用于mbr格式。
(2)单个文件在2T以上,需要使用parted来分区。
主要内容:
============================================
一、使用parted 进行分区
二、创建生产上使用的parted分区的步骤
============================================
一、使用parted 进行分
[[email protected] /]# parted /dev/sdd ###使用parted 对/dev/sdd进行分区
GNU Parted 2.1 ### parted的版本
Using /dev/sdd ### parted 执行操作的磁盘
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p ### 显示当前磁盘的分区
Model: VMware, VMware Virtual S (scsi) ###磁盘的信息,虚拟的scsi磁盘
Disk /dev/sdd: 1074MB ###磁盘的大小
Sector size (logical/physical): 512B/512B ###扇区大小
Partition Table: msdos ###当前磁盘分区表标签msdos
Number Start End Size File system Name Flags
(parted) mklabel ###创建磁盘分区标签
New disk label type? gpt ###设置磁盘分区标签为gpt
Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to
continue?
Yes/No? y ###继续
(parted) mkpart oracle 0 -1 ####创建磁盘分区从0开始,-1代表剩余全部。若为数值,如100 表示分区大小100M
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i ###忽略警告
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags ###新建分区信息
1 17.4kB 1073MB 1073MB oracle
(parted) mkpart ###交互式创建parted分区
Partition name? []? test ###分区名称
File system type? [ext2]? ext2 ###分区格式
Start? 1
End? 2
Warning: You requested a partition from 1000kB to 2000kB.
The closest location we can manage is 1073MB to 1073MB.
Is this still acceptable to you?
Yes/No? y
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 1073MB 1073MB oracle
2 1073MB 1073MB 512B test
(parted) rm 2
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 1073MB 1073MB oracle
(parted) q
Information: You may need to update /etc/fstab.
二、创建生产上使用的parted分区的步骤
【适用场景】如果Oracle 数据库需要添加10T备份空间,使用parted添加
步骤一:指定需要创建parted分解的存储设备
[[email protected] /]# parted /dev/sdd
GNU Parted 2.1
Using /dev/sdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
步骤二:查看当前parted分区情况
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
步骤三:创建parted的分区标签
(parted) mklabel
New disk label type? gpt
Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to
continue?
Yes/No? yes
步骤四: 创建parted的分区
(parted) mkpart oracle 0 -1
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 1073MB 1073MB oracle
(parted) q
Information: You may need to update /etc/fstab.
步骤五:对parted分区进行格式化
[[email protected] /]# mkfs.ext4 /dev/sdd1
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
65536 inodes, 261895 blocks
13094 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[[email protected] /]#
步骤六:挂载parted分区
[[email protected] /]# mount /dev/sdd1 /alexpeng/
[[email protected] /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 45G 4.4G 39G 11% /
tmpfs 1004M 0 1004M 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/sdb2 79G 184M 75G 1% /oracle
/dev/sdb1 20G 172M 19G 1% /soft
/dev/sdd1 1007M 18M 939M 2% /alexpeng
[[email protected] /]#
[[email protected] /]#
[[email protected] /]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/sdb2 on /oracle type ext4 (rw)
/dev/sdb1 on /soft type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sdd1 on /alexpeng type ext4 (rw)
步骤七:设置开启分区自启动
[[email protected] /]# vi /etc/fstab ###添加如下信息
/dev/sdd1 /alexpeng ext4 defaults 0 0
[[email protected] /]# umount /alexpeng/
[[email protected] /]# mount /alexpeng/
原文地址:http://blog.51cto.com/peenboo/2090374