LINUX用GPT格式大於2T系統盤

muxinqing發表於2014-01-14

檢視os系統塊的大小
[root]# /sbin/tune2fs -l /dev/sda1

[root@his1 ~]# fdisk -l

Disk /dev/sda: 12.3 GB, 12328140800 bytes
255 heads, 63 sectors/track, 1498 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26         286     2096482+  82  Linux swap / Solaris
/dev/sda3             287        1498     9735390   83  Linux

Disk /dev/sdb: 20.5 TB, 20573405184 bytes
255 heads, 63 sectors/track, 2501 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
   
[root@his1 ~]# 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                                                     
(parted) p                                                               

Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdb: 20.6TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0 -1
(parted) p                                                               

Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdb: 20.6GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  20.6GB  20.6GB               primary      

(parted) quit                                                            
                        
[root@his1 ~]# parted /dev/sdb mkfs

Warning: The existing file system will be destroyed and all data on the  
partition will be lost. Do you want to continue?

Yes/No? yes                                                              

Partition number? 1                                                      

File system?  [ext2]? ext3                                               

No Implementation: Support for creating ext3 file systems is not implemented  --這裡提示不支援ext3
yet.
Information: Don't forget to update /etc/fstab, if necessary.

沒有可以二種方式進行格式化

此時請注意新增引數: mkfs.ext3 -F /dev/sdb1
-F引數的含義:

Force mke2fs to run, even if the specified device is not a block special device, or appears to be mounted
它會強制mke2fs執行,不管指定的裝置是否塊裝置或著是已掛載的裝置

[root@his1 ~]#mkfs -t ext3 -b 8192 /dev/sdb1           (打算用8K的資料塊,但格式化時間太長,不想等)                                                      

Warning: blocksize 8192 not usable on most systems.                                                                  

mke2fs 1.39 (29-May-2006)                                                                                            

mkfs.ext3: 8192-byte blocks too big for system (max 4096)                                                            

Proceed anyway? (y,n)n                                                                              

這種格式成ext2檔案系統

[root@his1 ~]# parted /dev/sdb mkfs

Warning: The existing file system will be destroyed and all data on the  
partition will be lost. Do you want to continue?

Yes/No? yes                                                              

Partition number? 1                                                      

File system?  [ext2]?                                                    

Information: Don't forget to update /etc/fstab, if necessary.

建立檔案系統時,可以指定塊的大小。如果將來在你的檔案系統中是一些比較大的檔案的話,
使用較大的塊大小將得到較好的效能。將ext2檔案系統的塊大小調整為4096byte而不是預設
的1024byte,可以減少檔案碎片,加快fsck掃描的速度和檔案刪除以及讀操作的速度。另
外,在ext2的檔案系統中,為根目錄保留了5%的空間,對一個大的檔案系統,除非用作日誌
檔案,5%的比例有些過多。可以使用命令

# mke2fs -b 4096 -m 1 /dev/hda6

將它改為1%並以塊大小4096byte建立檔案系統。

使用多大的塊大小,需要根據你的系統綜合考慮,如果系統用作郵件或者新聞伺服器,使用較
大的塊大小,雖然效能有所提高,但會造成磁碟空間較大的浪費。比如檔案系統中的檔案平均
大小為2145byte,如果使用4096byte的塊大小,平均每一個檔案就會浪費1951byte空間。如果
使用1024byte的塊大小,平均每一個檔案會浪費927byte空間。在效能和磁碟的代價上如何平衡
,要看具體應用的需要。
塊尺寸         最大檔案尺寸         最大檔案系統尺寸
1KiB            16GiB         2TiB
 2KiB            256GiB         8TiB
 4KiB            2TiB         16TiB
 8KiB            16TiB         32TiB

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29065182/viewspace-1070540/,如需轉載,請註明出處,否則將追究法律責任。

相關文章