linux 超过2TB分区
大纲
1.添加一块超过2TB硬盘
2.尝试fdisk 对超过2TB分区
3.使用parted分区
1.可以看到添加一块硬盘超过2T
[root@mail ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 274 2096482+ 82 Linux swap / Solaris
/dev/sda3 275 2610 18763920 83 Linux
Disk /dev/sdb: 3221.2 GB, 3221225472000 bytes
255 heads, 63 sectors/track, 391625 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn‘t contain a valid partition table
2.尝试用fdisk 对sdb进行分区
[root@mail ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won‘t be recoverable.
The number of cylinders for this disk is set to 391625.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
WARNING: The size of this disk is 3.2 TB (3221225472000 bytes).
DOS partition table format can not be used on drives for volumes
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID
partition table format (GPT).
说明fdisk不支持超过2TB分区
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition‘s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): q
[root@mail ~]# uname -r
2.6.18-371.el5
[root@mail ~]# cat /etc/redhat-release
CentOS release 5.10 (Final)
3.用parted 分区
[root@mail ~]# parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help‘ to view a list of commands.
(parted) mklabel gpt --将MBR磁盘格式化为GPT
(parted) print #打印当前分区
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 3221GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
(parted) mkpart primary 0 3.2TB ---# 分一个3.2T的主分区
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 3221GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 3221GB 3221GB primary
(parted) quit
Information: Don‘t forget to update /etc/fstab, if necessary.
4.然后格式化成ext3
[root@mail ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
393216000 inodes, 786431991 blocks
39321599 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
24000 block groups
32768 blocks per group, 32768 fragments per group
16384 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:
done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@mail ~]#
5.接着用mount挂载分区
[root@mail ~]# mkdir /gpt
[root@mail ~]# mount /dev/sdb1 /gpt
[root@mail ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 18G 2.3G 15G 14% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 1005M 0 1005M 0% /dev/shm
/dev/sdb1 2.9T 200M 2.8T 1% /gpt
6.最后修改/etc/fstab,添加如下两行,让其开机自动挂载.
/dev/sdb1 /gpt ext3 defaults,noatime 1 2
本文出自 “steven 业精于勤荒于嬉..” 博客,请务必保留此出处http://steven2.blog.51cto.com/855881/1532042
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。