-- Leo's gemini proxy

-- Connecting to gmi.noulin.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

How to create a partition larger than 2TB with fdisk


Feed


date: 2023-03-21 15:33:45


categories: tools


firstPublishDate: 2023-03-21 15:33:45


On a new 4TB SSD, I ran these commands and the new partion was 2TB:


fdisk /dev/nvme0n1

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
The size of this disk is 3.6 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS (MBR) disklabel with disk identifier 0xefe222ab.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-4294967295, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-4294967295, default 4294967295):

Created a new partition 1 of type 'Linux' and of size 2 TiB

By default, fdisk creates a DOS partition table and as written in warning message above, the largest partition in a DOS partition table is 2TB.


A GPT partition table needs to be created, in fdisk it is done with the 'g' command:


fdisk /dev/nvme0n1
# or
# fdisk -n /dev/nvme0n1
# to not create a default partition table

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The size of this disk is 3.6 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Command (m for help): g
Created a new GPT disklabel (GUID: 65F870F4-96CD-294A-99D5-E009CB0122D4).
The device contains 'dos' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Command (m for help): p

Disk /dev/nvme0n1: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: Seagate FireCuda 530 ZP4000GM30013
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 65F870F4-96CD-294A-99D5-E009CB0122D4

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-7814037134, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-7814037134, default 7814035455):

Created a new partition 1 of type 'Linux filesystem' and of size 3.6 TiB.
Partition #1 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: Y

The signature will be removed by a write command.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Then I create an ext4 file system in the 4TB partition:


# mkfs -t ext4 /dev/nvme0n1p1
mke2fs 1.46.6 (1-Feb-2023)
Discarding device blocks: done
Creating filesystem with 976754176 4k blocks and 244195328 inodes
Filesystem UUID: acf7bbfa-4321-42b5-b785-a6993b742679
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

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

# mount /dev/nvme0n1p1 /mnt

Hashtag: #fdisk


Feed

-- Response ended

-- Page fetched on Tue May 21 15:46:59 2024