Linux 分区、格式化3T大容量存储分区

原创
2016/01/29 16:02
阅读数 3.1K

1. 使用parted命令分区超过2TB容量的裸设备

# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: IBM VirtualDisk (scsi)
Disk /dev/sdb: 3597GB
Sector size (logical/physical): 512B/512B

(parted) help 

(parted) mklabel gpt

(parted) mkpart                                                           
Partition name?  []?    直接回车                                                 
File system type?  [ext2]? ext4                                           
Start? 1 或 0%                                                                
End? 3597GB或100%

(parted) print                                                            
Model: IBM VirtualDisk (scsi)
Disk /dev/sdb: 3597GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  3597GB  3597GB         

(parted) quit             #注意,使用parted命令是直接对磁盘生效的,不像fdisk还有个w保存的机会,这里不给你反悔的机会直接生效了。                                               
Information: You may need to update /etc/fstab. 

2. 使用mkfs.ext4格式化已经做好的分区

我们先使用fdisk -l命令查看一下分区表的情况

# fdisk -l

Disk /dev/sda: 300.0 GB, 299966445568 bytes
255 heads, 63 sectors/track, 36468 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x0001b658

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1070     8388608   82  Linux swap / Solaris
/dev/sda3            1070       36469   284341248   83  Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 3597.0 GB, 3597035110400 bytes
255 heads, 63 sectors/track, 437314 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      267350  2147483647+  ee  GPT

快速格式化该分区的方法:

# mkfs.ext4 -T largefile /dev/sdb1
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
3430400 inodes, 878181888 blocks
43909094 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
26800 block groups
32768 blocks per group, 32768 fragments per group
128 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: 直接回车


直接使用mkfs.ext4 格式化,不使用-T largefile参数的情况下,屏幕上会一直显示下面的信息,



展开阅读全文
打赏
1
6 收藏
分享
加载中
更多评论
打赏
0 评论
6 收藏
1
分享
返回顶部
顶部