linux支持2T以上大硬盘分区的安装手记

背景:构建图书馆光盘管理系统FTP,6块硬盘,每个1TB,用一块硬盘做raid0,安装系统,剩余5块做raid5。由于ext3文件系统不支持大于2TB的分区,所以考虑使用GPT首先以root身份登录系统,查看硬盘信息:fdisk -l

  1. [root@libftp ~]# fdisk -l
  2. Disk /dev/cciss/c0d0: 1000.1 GB, 1000171331584 bytes
  3. 255 heads, 63 sectors/track, 121597 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes
  5.            Device Boot      Start         End      Blocks   Id  System
  6. /dev/cciss/c0d0p1   *           1          33      265041   83  Linux
  7. /dev/cciss/c0d0p2              34      116105   932348340   83  Linux
  8. /dev/cciss/c0d0p3          116106      118655    20482875   83  Linux
  9. /dev/cciss/c0d0p4          118656      121597    23631615    5  Extended
  10. /dev/cciss/c0d0p5          118656      120567    15358108+  83  Linux
  11. /dev/cciss/c0d0p6          120568      121587     8193118+  82  Linux swap / Solaris
  12. WARNING: GPT (GUID Partition Table) detected on '/dev/cciss/c0d1'! The util fdisk doesn't support GPT. Use GNU Parted.
  13. Disk /dev/cciss/c0d1: 4000.6 GB, 4000684662784 bytes
  14. 255 heads, 63 sectors/track, 486388 cylinders
  15. Units = cylinders of 16065 * 512 = 8225280 bytes
  16.            Device Boot      Start         End      Blocks   Id  System
  17. /dev/cciss/c0d1p1               1      267350  2147483647+  ee  EFI GPT
复制代码

使用parted命令:

  1. [root@libftp ~]# parted /dev/cciss/c0d1
  2. GNU Parted 1.8.1
  3. Using /dev/cciss/c0d1
  4. Welcome to GNU Parted! Type 'help' to view a list of commands.
  5. (parted) mklabel gpt                                                      
  6. Warning: The existing disk label on /dev/cciss/c0d1 will be destroyed and all data on this disk will be lost. Do you want to
  7. continue?
  8. Yes/No? y                                                                                                         
  9. New disk label type?  [gpt]? gpt
复制代码

下一步:由MBR转为GPT磁盘

  1. (parted) mkpart primary 0 4000GB
复制代码

print:

  1. (parted) print                                                            
  2. Model: Compaq Smart Array (cpqarray)
  3. Disk /dev/cciss/c0d1: 4001GB
  4. Sector size (logical/physical): 512B/512B
  5. Partition Table: gpt
  6. Number  Start   End     Size    File system  Name     Flags
  7. 1      17.4kB  4001GB  4001GB               primary      
  8. (parted) quit                                                            
  9. Information: Don't forget to update /etc/fstab, if necessary.            
复制代码

下一步:格式化

  1. [root@libftp ~]# mkfs.ext3 -F /dev/cciss/c0d1
  2. mke2fs 1.39 (29-May-2006)
  3. Filesystem label=
  4. OS type: Linux
  5. Block size=4096 (log=2)
  6. Fragment size=4096 (log=2)
  7. 488374272 inodes, 976729654 blocks
  8. 48836482 blocks (5.00%) reserved for the super user
  9. First data block=0
  10. Maximum filesystem blocks=0
  11. 29808 block groups
  12. 32768 blocks per group, 32768 fragments per group
  13. 16384 inodes per group
  14. Superblock backups stored on blocks:
  15.         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
  16.         4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
  17.         102400000, 214990848, 512000000, 550731776, 644972544
  18. Writing inode tables: done                           
  19. Creating journal (32768 blocks): done
  20. Writing superblocks and filesystem accounting information: done
  21. This filesystem will be automatically checked every 22 mounts or
  22. 180 days, whichever comes first.  Use tune2fs -c or -i to override.
复制代码

此时注意事项:mkfs.ext3 -F   后面要跟上 -F下一步 :挂载

  1. [root@libftp ~]# mkdir -p /mnt/cciss/c0d1
  2. [root@libftp ~]# mount /dev/cciss/c0d1 /mnt/cciss/c0d1
复制代码

查看:

  1. [root@libftp ~]# df -h
  2. Filesystem            Size  Used Avail Use% Mounted on
  3. /dev/cciss/c0d0p5      15G  1.8G   12G  13% /
  4. /dev/cciss/c0d0p3      19G  173M   18G   1% /usr/local
  5. /dev/cciss/c0d0p2     862G  200M  817G   1% /else
  6. /dev/cciss/c0d0p1     251M   21M  218M   9% /boot
  7. tmpfs                 2.0G     0  2.0G   0% /dev/shm
  8. /dev/cciss/c0d1       3.6T  197M  3.4T   1% /mnt/cciss/c0d1
复制代码

开机自动挂载这块硬盘:vi /etc/rc.local加上:

  1. mount /dev/cciss/c0d1 /mnt/cciss/c0d1
复制代码
原文地址:https://www.cnblogs.com/youlechang123/p/2551750.html