Linux系统超过2T磁盘格式化

Linux系统超过2T磁盘格式化

查看系统信息
[root@localhost ~]# cat /etc/RedHat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
[root@localhost ~]# uname -r
2.6.18-194.el5
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@localhost log]# uname -r
2.6.18-194.el5  //最小也的是2.6.18.24
查看磁盘情况
[root@localhost ~]# 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  65  522081  83  Linux
/dev/sda2  66  196  1052257+  82  Linux swap / Solaris
/dev/sda3  197  2610  19390455  83  Linux
Disk /dev/sdb: 2190.4 GB, 2190433320960 bytes  //已经是2T左右了
255 heads, 63 sectors/track, 266305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
[root@localhost ~]# rpm -qf /sbin/parted //安装工具包
parted-1.8.1-27.el5
[root@localhost ~]# parted /dev/sdb  //开始对大容量的磁盘操作
[root@localhost ~]# parted /dev/sdb
GNU Parted 1.8.1
使用/dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free  //第一次是打印不了信息的,因为没有
错误:无法打开/dev/sdb -无法识别的磁盘标签。
(parted) help  //显示帮助信息
check NUMBER  do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER  copy file system to another partition
help [COMMAND]  prints general help, or help on COMMAND
mklabel,mktable LABEL-TYPE  create a new disklabel (partition table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on partititon NUMBER
mkpart PART-TYPE [FS-TYPE] START END  make a partition
mkpartfs PART-TYPE FS-TYPE START END  make a partition with a file system
move NUMBER START END  move partition NUMBER
name NUMBER NAME  name partition NUMBER as NAME
print [free|NUMBER|all]  display the partition table, a partition, or all devices
quit  exit program
rescue START END  rescue a lost partition near START and END
resize NUMBER START END  resize partition NUMBER and its file system
rm NUMBER  delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE  change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]]  toggle the state of FLAG on partition NUMBER
unit UNIT  set the default unit to UNIT
version  displays the current version of GNU Parted and copyright information
(parted) mklabel  //改变分区表的格式
新的磁盘标签类型?gpt  //设置为gpt的分区格式
(parted) mkpart
分区名称? []? /dev/sdb1  //填写分区名称
文件系统类型? [ext2]? ext3  //填写格式化类型
起始点?0//0代表是从第一个磁道开始的
结束点?-1//-1是代表到最后一个磁道
(parted) print free
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 2190GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt  //修改为gpt格式
Number  Start  End  Size  File system  Name 标志
1  17.4kB  2190GB  2190GB  /dev/sdb1
(parted)quit  //退出
2.6.24
[root@localhost ~]# mkfs.ext3 -b 8192 /dev/sdb1
[root@localhost ~]# mkfs.ext3  -F /dev’sdb1
[root@localhost ~]# mount  -t ext3 /dev/sdb1 /01
-F是强制的意思
-b 8192(8M)是指定块大小,8M只能支持到16TB的空间,如果还是比较大的话就多指定点就行了
格式化会很长时间
[root@localhost log]# mount -t ext3 /dev/sdb1 /01
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail  or so
[root@localhost log]# mkfs.ext3 -F /dev/sdb1  //添加-F参数就能解决这个问题
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
267386880 inodes, 534773751 blocks
26738687 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
16320 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost log]#


[root@localhost log]# mount -t ext3 /dev/sdb1 /01


[root@localhost log]# df -h
文件系统容量已用可用已用%挂载点
/dev/sda3  18G  3.8G  14G  23% /
/dev/sda1  494M  17M  453M  4% /boot
tmpfs  506M  0  506M  0% /dev/shm
/dev/sdb1  2.0T  199M  1.9T  1% /01


就可以了.

相关推荐