knowplace.org

Linux - Large Filesystems Support

Contents

Overview

This article covers using large filesystems (larger than 2TB) on Linux. Since fdisk (cfdisk/sfdisk), etc. doesn't support creating partitions larger than 2TB, it's necessary to use GNU Parted to create an EFI GUID Partition.  It is recommended that you use LVM2 and JFS although strictly speaking, neither are "necessary."


Requirements

Also, in order to create partitions larger than 2TB on Linux, the kernel needs to support:

File Systems
Partition Types
[*] Advanced partition selection
[*] EFI GUID Partition support (NEW)



Creating EFI GUID Partitions

The examples below will use /dev/sda as the block device.

  • Run the GNU Parted command shel
# parted /dev/sda
GNU Parted 1.7.1

Using /dev/sda

Welcome to GNU Parted! Type 'help' to view a list of commands

(parted)

  • Make the disk label
(parted) mklabel gpt
  • Create the partition
(parted) mkpart primary 0 -1
  • Verify
(parted) print

Disk /dev/sda: 5435GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

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

  • Exit the GNU Parted command shell
(parted) quit


Filesystems

While it's possible to create 8TB+ EXT3 partitions on the real block device, I recommend that you use JFS (for both speed and storage efficiency) on top of LVM2.  My experiences with XFS has been bad enough on Linux that I wouldn't consider using it for anything in production (note that XFS on Linux is not the same as XFS on SGI).  The LVM HOWTO can be found at http://tldp.org/HOWTO/LVM-HOWTO.  Note that if you don't create the GPT disk label as outlined above, LVM will only recognize up to 2TB.

  Continuing using the /dev/sda example, the partition we've created will be /dev/sda1.

  • Initialize the partition for LVM
# pvcreate /dev/sda1
  • Create the volume group
# vgcreate vg0 /dev/sda1
  • Assuming you want to use all the space available, list the free physical extent
# vgdisplay
  • Note the free physical extents (PE) such as:
Free  PE / Size       3262837 / 12.45 TB
  • Create the logical volume (where -n is the volume name and -l is the free PE available)

lvcreate -n bigvol -l3262837 vg0
  • Create the filesystem
# mkfs.jfs /dev/vg0/bigvol

Additional Notes

Performance-wise, you may also want to change the default IO scheduler to CFQ or Deadline either via the kernel configuration or via the command-line:

 ( ) Anticipatory
 ( ) Deadline
 (X) CFQ
 ( ) No-op

or

echo "cfq" > /block/sda/queue/scheduler

Although I don't recommend that you use what's below, I am including the info for just to document it.  In order to create filesystems larger than 8TB with EXT3 (not recommended), e2fsprogs 1.39+ is needed.

Note: Without the -F flag, mkfs.ext3 will return an error such as below.

mkfs.ext3: Filesystem too large.  No more than 2**31-1 blocks
(8TB using a blocksize of 4k) are currently supported.
  • Create the filesystem

# mkfs.ext3 -m0 -F /dev/sda1

Note: '-m' sets the reserved block to zero. Additionally, you may wish to change the max mount counts or intervals between checks using tune2fs such as:

# tune2fs -c0 -i0 /dev/sda1

 
Shane Tzen © 2010