{"id":4787,"date":"2024-06-16T12:23:49","date_gmt":"2024-06-16T04:23:49","guid":{"rendered":"https:\/\/www.ookangzheng.com\/?p=4787"},"modified":"2024-08-20T15:26:20","modified_gmt":"2024-08-20T07:26:20","slug":"debian-partition-disk-over-2tb","status":"publish","type":"post","link":"https:\/\/www.ookangzheng.com\/debian-partition-disk-over-2tb\/","title":{"rendered":"Debian partition disk over 2TB"},"content":{"rendered":"\n

Usually you cannot create a Linux partition larger than 2 TB using the fdisk<\/code> command. The fdisk won\u2019t create partitions larger than 2 TB. If you need a large partition on Linux Server, It will not allow you to create a partition that is greater than 2TB. In this tutorial, You will learn how to format a 4TB hard disk and mount it.<\/p>\n\n\n\n

Find Out The Current Linux Disk Size<\/h3>\n\n\n\n

Type the following command:<\/p>\n\n\n\n

fdisk -l | grep '^Disk'<\/code><\/pre>\n\n\n\n
\"\"<\/a><\/figure>\n\n\n\n

You will see I need to format \/dev\/sdb<\/code> (3.91 TiB)<\/p>\n\n\n\n

Start to format the disk<\/h3>\n\n\n\n

To create a partition start GNU parted as follows:<\/p>\n\n\n\n

fdisk -l \/dev\/sdb

parted \/dev\/sdb<\/code><\/pre>\n\n\n\n


Output:<\/p>\n\n\n\n

GNU Parted 2.3
Using \/dev\/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.<\/pre>\n\n\n\n

Creates a new GPT disklabel i.e. partition table:<\/p>\n\n\n\n

 mklabel gpt<\/strong><\/pre>\n\n\n\n

Sample outputs, and type “Yes” to continue,<\/p>\n\n\n\n

Warning: The existing disk label on \/dev\/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes\/No? yes<\/strong><\/pre>\n\n\n\n

Set up 4.00TB<\/p>\n\n\n\n

 mkpart primary 0.00TB 4.00TB<\/strong><\/pre>\n\n\n\n

To print the current partitions, enter:<\/p>\n\n\n\n

 print<\/strong>\u00a0<\/pre>\n\n\n\n

Sample outputs:<\/p>\n\n\n\n

Model: ATA ST33000651AS (scsi)
Disk \/dev\/sdb: 4.00TB
Sector size (logical\/physical): 512B\/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 0.00TB 4.00TB 4.00TB ext4 primary<\/pre>\n\n\n\n

Then type quit parted<\/code><\/p>\n\n\n\n

quit<\/code><\/pre>\n\n\n\n

Please use screen<\/code> command before you proceed command below to avoid Broken pipe for SSH connection.<\/p>\n\n\n\n

screen -S hdd<\/code><\/pre>\n\n\n\n

Use the mkfs.ext4 command to format the file system, enter:<\/p>\n\n\n\n

mkfs.ext4 \/dev\/sdb1<\/code><\/pre>\n\n\n\n

Mount the disk<\/h3>\n\n\n\n
mkdir \/hdd2\n\nmount \/dev\/sdb1 \/hdd2<\/code><\/pre>\n\n\n\n

Use df -H<\/code> to check your hard disk<\/p>\n\n\n\n

\"\"<\/a><\/figure>\n\n\n\n
\n\n\n\n

Another update for the code<\/p>\n\n\n\n

parted \/dev\/sdb\nGNU Parted 3.5\nUsing \/dev\/sdb\nWelcome to GNU Parted! Type 'help' to view a list of commands.\n(parted) mklabel gpt\nWarning: The existing disk label on \/dev\/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?\nYes\/No? Yes\n(parted) unit TB\n(parted) mkpart\nPartition name?  []? 4tb\nFile system type?  [ext2]? ext4\nStart? 0\nEnd? 4\n(parted) print\nModel: ATA HGST HMS5C4040BL (scsi)\nDisk \/dev\/sdb: 4.00TB\nSector size (logical\/physical): 512B\/4096B\nPartition Table: gpt\nDisk Flags:\n\nNumber  Start   End     Size    File system  Name  Flags\n 1      0.00TB  4.00TB  4.00TB  ext4         4tb\n\n(parted) quit\nInformation: You may need to update \/etc\/fstab.\n\nroot@Debian-1205-bookworm-amd64-base ~ # mkfs -t ext4 \/dev\/sdb1\nmke2fs 1.47.0 (5-Feb-2023)\n\/dev\/sdb1 contains a ext4 file system\n\tcreated on Tue Aug 20 08:20:59 2024\nProceed anyway? (y,N) y\nCreating filesystem with 976754176 4k blocks and 244195328 inodes\nFilesystem UUID: 48372c58-b403-4e49-9b54-a5053ae2a635\nSuperblock backups stored on blocks:\n\t32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,\n\t4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,\n\t102400000, 214990848, 512000000, 550731776, 644972544\n\nAllocating group tables: done\nWriting inode tables: done\nCreating journal (262144 blocks): done\nWriting superblocks and filesystem accounting information: done<\/code><\/pre>\n\n\n\n

Reference<\/p>\n\n\n\n

    \n
  1. https:\/\/www.cyberciti.biz\/tips\/fdisk-unable-to-create-partition-greater-2tb.html<\/a><\/li>\n\n\n\n
  2. https:\/\/gparted.org\/<\/a><\/li>\n\n\n\n
  3. https:\/\/www.cyberciti.biz\/faq\/linux-disk-format\/<\/a><\/li>\n\n\n\n
  4. https:\/\/www.cyberciti.biz\/faq\/linux-check-boot-path-command\/<\/a><\/li>\n\n\n\n
  5. https:\/\/yylin.medium.com\/%E5%A6%82%E4%BD%95%E6%8E%9B%E8%BC%892tb%E4%BB%A5%E4%B8%8A%E7%A1%AC%E7%A2%9F-614e6e6d005a<\/a> ( Chinese version)<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

    Usually you cannot create a Linux partition larger than 2 TB using the fdisk command. The fdisk won\u2019t create partitions…<\/p>\n","protected":false},"author":1,"featured_media":4790,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,32],"tags":[],"class_list":["post-4787","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-technology"],"_links":{"self":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/4787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/comments?post=4787"}],"version-history":[{"count":3,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/4787\/revisions"}],"predecessor-version":[{"id":4854,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/4787\/revisions\/4854"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/media\/4790"}],"wp:attachment":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/media?parent=4787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/categories?post=4787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/tags?post=4787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}