您的位置:首页 > 运维架构 > Linux

使用Parted 对超过2TB的硬盘进行分区

2016-11-04 15:51 567 查看
fdisk -l
parted /dev/sdd
mklabel gpt
print
mkpart primary 0KB 6001GB
y
i
print
quit

fdisk -l
mkfs.ext4 /dev/sdd1
blkid
mkdir -pv /disk2
mount UUID="d1301f0e-45c5-4bc6-abc2-0687308c2ad6" /disk2

vi /etc/fstab

UUID=d1301f0e-45c5-4bc6-abc2-0687308c2ad6 /disk2 ext4 defaults 0 0

or:
vi /etc/rc.local
mount UUID="d1301f0e-45c5-4bc6-abc2-0687308c2ad6" /disk2

======================================

测试iscsi服务是否正常

[root@FocusBackup ~]# service iscsi restart停止 iscsi: [确定][root@FocusBackup ~]# chkconfig iscsi on[root@FocusBackup ~]# iscsiadm -m discovery -t sendtargets -p 10.5.83.131正在启动 iscsid: [确定]10.5.83.131:3260,1 iqn.2006-01.com.openfiler:tsn.vmlocalbackup[root@FocusBackup ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.vmlocalbackup -p 10.5.83.131 -lLogging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.vmlocalbackup, portal: 10.5.83.131,3260] (multiple)Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.vmlocalbackup, portal: 10.5.83.131,3260] successful.

查看硬盘设备

[root@FocusBackup ~]# fdisk -l Disk /dev/sda: 322.1 GB, 322122547200 bytes255 heads, 63 sectors/track, 39162 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000a4673 Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 1332 10485760 82 Linux swap / Solaris/dev/sda3 1332 26109 199023616 83 Linux/dev/sda4 26109 39163 104857600 5 Extended/dev/sda5 26109 39163 104856576 83 Linux Disk /dev/sdb: 2199.0 GB, 2199023254528 bytes255 heads, 63 sectors/track, 267349 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000bfa7a Device Boot Start End Blocks Id System/dev/sdb1 1 267349 2147480811 83 Linux Disk /dev/sdd: 1099.5 GB, 1099511627776 bytes255 heads, 63 sectors/track, 133674 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 Disk /dev/sdd doesn't contain a valid partition table Disk /dev/sdc: 2199.0 GB, 2199023254528 bytes255 heads, 63 sectors/track, 267349 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x26e7758c Device Boot Start End Blocks Id System/dev/sdc1 1 267349 2147480811 83 Linux WARNING: GPT (GUID Partition Table) detected on '/dev/sde'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sde: 6597.0 GB, 6596969103360 bytes255 heads, 63 sectors/track, 802035 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id System/dev/sde1 1 267350 2147483647+ ee GPT

对超过2TB的硬盘进行分区需要使用parted

[root@FocusBackup ~]# parted /dev/sdeGNU Parted 2.1使用 /dev/sdeWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) mklabel gpt警告: The existing disk label on /dev/sde will be destroyed and all data on this disk will be lost. Do you want to continue?/Yes//No? y(parted) print Model: OPNFILER VIRTUAL-DISK (scsi)Disk /dev/sde: 6597GBSector size (logical/physical): 512B/512BPartition Table: gpt Number Start End Size File system Name 标志 (parted) mkpart primary 0KB 6597GB 警告: You requested a partition from 0.00B to 6597GB. The closest location we can manage is 17.4kB to 6597GB.Is this still acceptable to you?/Yes//No? y警告: The resulting partition is not properly aligned for best performance.忽略/Ignore/放弃/Cancel? i (parted) print Model: OPNFILER VIRTUAL-DISK (scsi)Disk /dev/sde: 6597GBSector size (logical/physical): 512B/512BPartition Table: gpt Number Start End Size File system Name 标志 1 17.4kB 6597GB 6597GB primary (parted) quit 信息: You may need to update /etc/fstab.

对创建好的大分区进行格式化

[root@FocusBackup ~]# fdisk -l Disk /dev/sda: 322.1 GB, 322122547200 bytes255 heads, 63 sectors/track, 39162 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000a4673 Device Boot Start End Blocks Id System/dev/sda1 * 1 26 204800 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 26 1332 10485760 82 Linux swap / Solaris/dev/sda3 1332 26109 199023616 83 Linux/dev/sda4 26109 39163 104857600 5 Extended/dev/sda5 26109 39163 104856576 83 Linux Disk /dev/sdb: 2199.0 GB, 2199023254528 bytes255 heads, 63 sectors/track, 267349 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000bfa7a Device Boot Start End Blocks Id System/dev/sdb1 1 267349 2147480811 83 Linux Disk /dev/sdd: 1099.5 GB, 1099511627776 bytes255 heads, 63 sectors/track, 133674 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 Disk /dev/sdc: 2199.0 GB, 2199023254528 bytes255 heads, 63 sectors/track, 267349 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x26e7758c Device Boot Start End Blocks Id System/dev/sdc1 1 267349 2147480811 83 Linux WARNING: GPT (GUID Partition Table) detected on '/dev/sde'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sde: 6597.0 GB, 6596969103360 bytes255 heads, 63 sectors/track, 802035 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id System/dev/sde1 1 267350 2147483647+ ee GPT[root@FocusBackup ~]# mkfs.ext4 /dev/sde1mke2fs 1.41.12 (17-May-2010)文件系统标签=操作系统:Linux块大小=4096 (log=2)分块大小=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks402653184 inodes, 1610588151 blocks80529407 blocks (5.00%) reserved for the super user第一个数据块=0Maximum filesystem blocks=429496729649152 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock 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 正在写入inode表: 完成 Creating journal (32768 blocks): 完成Writing superblocks and filesystem accounting information: 完成 This filesystem will be automatically checked every 37 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.

写入开机启动项,完成挂载操作

可以使用vi /etc/fstab也可以使用vi /etc/rc.local
http://www.cnblogs.com/mannyzhoug/archive/2013/08/27/3284572.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  parted linux 分区 TB