How to create a partition size larger than 2 TB on linux
ปัจจุบัน harddisk มีขนาดที่ใหญ่มากกว่า 2TB พบเห็นได้ไม่ยาก แต่การจัดการ partition ที่ disk มีขนาดใหญ่กว่า 2TB จะไม่สามารถใช้ fdisk ได้เนื่องจาก fdisk รองรับการสร้าง parition แบบ MBR (ล้าสมัยไปแล้ว) เท่านั้น ซึ่งเป็นข้อจำกัดที่ทำให้ fdisk ไม่สามารถจัดการ disk ที่มีขนาดใหญ่กว่า 2TB ได้ ดังนั้นจำเป็นต้องหาโปรแกรมอื่นที่รองรับ Globally Unique Identifier (GUID) Partition Table (GPT) ซึ่ง partition table นี้สามารถรองรับ disk ที่มีขนาดใหญ่กว่า 2TB
ในปัจจุบันมีโปรแกรมจัดการ parition หลายตัวที่รองรับ GPT แต่มีโปรแกรมหนึ่งที่อยากจะแนะนำให้ลองใช้งาน นั้นคือ gdisk ซึ่งการใช้งานจะคล้ายๆกับการใช้ fdisk แต่สามารถแบ่ง partition ให้กับ disk ที่มีขนาดใหญ่กว่า 2TB และยังสามารถแบ่ง partition ได้มากถึง 128 partition อีกด้วย
วิธีการติดตั้งและใช้งาน gdisk
- ให้ติดตั้ง EPEL repo ก่อน โดย Download URL สามารถตรวจสอบได้ที่ RPM repository of RPM add-on packages for Red Hat Enterprise Linux and CentOS
- ติดตั้ง gdisk ด้วยคำสั่ง
123[root@Ezylinux.com ~]# yum install gdisk - รันคำสั่ง gdisk เพื่อทำการแบ่ง partition ของ disk โดยในตัวอย่างด้านล่าง disk จะมีชื่อว่า sdb
123456789101112[root@Ezylinux.com ~]# gdisk /dev/sdbGPT fdisk (gdisk) version 0.8.4Partition table scan:MBR: protectiveBSD: not presentAPM: not presentGPT: presentFound valid GPT with protective MBR; using GPT.
- จากนั้นให้กด o เพื่อทำการสร้าง GUID partition table
1234567891011121314151617181920212223Command (? for help): ?b back up GPT data to a filec change a partition's named delete a partitioni show detailed information on a partitionl list known partition typesn add a new partitiono create a new empty GUID partition table (GPT)p print the partition tableq quit without saving changesr recovery and transformation options (experts only)s sort partitionst change a partition's type codev verify diskw write table to disk and exitx extra functionality (experts only)? print this menuCommand (? for help): oThis option deletes all partitions and creates a new protective MBR.Proceed? (Y/N): y
- จากนั้นกด n เพื่อสร้าง partition และตามด้วย 1 จากนั้น enter 2 ครั้ง (เลือกเนื้อที่ทั้งหมด) และกด enter หาก ใช้งานบน linux แต่ถ้าหากใช้งานอย่างอื่น ให้กด L เพื่อดูรายละเอียดชนิดของ partition โดยตัวอย่างนี้จะแสดงการสร้าง partition เพียงแค่ 1 partition เท่านั้น ดังตัวอย่าง
12345678910111213141516171819202122232425262728Command (? for help): nPartition number (1-128, default 1): 1First sector (34-19393401950, default = 2048) or {+-}size{KMGTP}:Last sector (2048-19393401950, default = 19393401950) or {+-}size{KMGTP}:Current type is 'Linux filesystem'Hex code or GUID (L to show codes, Enter = 8300): L0700 Microsoft basic data 0c01 Microsoft reserved 2700 Windows RE4200 Windows LDM data 4201 Windows LDM metadata 7501 IBM GPFS7f00 ChromeOS kernel 7f01 ChromeOS root 7f02 ChromeOS reserved8200 Linux swap 8300 Linux filesystem 8301 Linux reserved8e00 Linux LVM a500 FreeBSD disklabel a501 FreeBSD boota502 FreeBSD swap a503 FreeBSD UFS a504 FreeBSD ZFSa505 FreeBSD Vinum/RAID a800 Apple UFS a901 NetBSD swapa902 NetBSD FFS a903 NetBSD LFS a904 NetBSD concatenateda905 NetBSD encrypted a906 NetBSD RAID ab00 Apple bootaf00 Apple HFS/HFS+ af01 Apple RAID af02 Apple RAID offlineaf03 Apple label af04 AppleTV recovery af05 Apple Core Storagebe00 Solaris boot bf00 Solaris root bf01 Solaris /usr & Mac Zbf02 Solaris swap bf03 Solaris backup bf04 Solaris /varbf05 Solaris /home bf06 Solaris alternate se bf07 Solaris Reserved 1bf08 Solaris Reserved 2 bf09 Solaris Reserved 3 bf0a Solaris Reserved 4bf0b Solaris Reserved 5 c001 HP-UX data c002 HP-UX serviceef00 EFI System ef01 MBR partition scheme ef02 BIOS boot partitionfd00 Linux RAIDHex code or GUID (L to show codes, Enter = 8300): 8300Changed type of partition to 'Linux filesystem'
- กด p เพื่อตรวจสอบรายละเอียดของ partition ที่ได้สร้างไว้
12345678910111213Command (? for help): pDisk /dev/sdb: 19393401984 sectors, 9.0 TiBLogical sector size: 512 bytesDisk identifier (GUID): E7327A36-2410-419C-96F1-4874EE7CAEEDPartition table holds up to 128 entriesFirst usable sector is 34, last usable sector is 19393401950Partitions will be aligned on 2048-sector boundariesTotal free space is 2014 sectors (1007.0 KiB)Number Start (sector) End (sector) Size Code Name1 2048 19393401950 9.0 TiB 8300 Linux filesystem
- กด w เพื่อ save
12345678910Command (? for help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTINGPARTITIONS!!Do you want to proceed? (Y/N): yOK; writing new GUID partition table (GPT) to /dev/emcpowera.The operation has completed successfully.
- ตรวจสอบดู partition table อีกครั้ง ด้วยคำสั่ง
12345678910111213141516171819202122[root@Ezylinux.com ~]# gdisk -l /dev/sdbGPT fdisk (gdisk) version 0.8.4Partition table scan:MBR: protectiveBSD: not presentAPM: not presentGPT: presentFound valid GPT with protective MBR; using GPT.Disk /dev/sdb: 19393401984 sectors, 9.0 TiBLogical sector size: 512 bytesDisk identifier (GUID): E7327A36-2410-419C-96F1-4874EE7CAEEDPartition table holds up to 128 entriesFirst usable sector is 34, last usable sector is 19393401950Partitions will be aligned on 2048-sector boundariesTotal free space is 2014 sectors (1007.0 KiB)Number Start (sector) End (sector) Size Code Name1 2048 19393401950 9.0 TiB 8300 Linux filesystem
จะเห็นว่ามี partition จำนวน 1 partition เพิ่มขึ้นมา ขั้นตอนจากนี้ก็ทำการ format partition ด้วย file system ที่ต้องการได้เลยครับ