Table of Contents

Large Partitions

RedHat Way

Red Hat Enterprise Linux 5.1 and later supports ext3 filesystems up to 16 Terabytes in size. Please see the Red Hat Enterprise Linux 5 Release Notes for further information.

In order to create EXT3 filesystems greater than 2TB, use the normal LVM and mkfs.ext3 commands as follows (assuming the block device for the storage is “/dev/sdd”):

pvcreate /dev/sdd
vgcreate BigGroup /dev/sdd
lvcreate -L 8000G -n bigvol BigGroup
mkfs.ext3 /dev/BigGroup/bigvol

This example created an 8 TB EXT3 filesystem on /dev/sdd. Since fdisk on the x86 platform is not compatible with partition layouts larger than 2.1TB, it's necessary to use the block devices directly to create physical volumes for LVM.

In order to create filesystems greater than 8 TB, invoke mkfs.ext3 with 4K blocks and the “-F” option:

pvcreate /dev/sdd
vgcreate BiggerGroup /dev/sdd
lvcreate -L 16000G -n biggervol BiggerGroup
mkfs.ext3 -F -b 4096 /dev/BiggerGroup/biggervol

Parted Way

Using Parted

# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/sdb: unrecognised disk label
(parted) mklabel gpt
(parted) print
Model: Unknown (unknown)
Disk /dev/sdb: 5909GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start  End  Size  File system  Name  Flags

Use parted’s mkpart command as shown below to create partition that is greater than 2TB. In this example, we are creating a partition that is roughly of 6TB in size.

# parted /dev/sdb
(parted) mkpart primary 0GB 5909GB
(parted) print
Model: Unknown (unknown)
Disk /dev/sdb: 5909GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
 1      1049kB  5909GB  5909GB               primary

Disk Management

Show partitions on a disk

fdisk -l

Show LVM information

pvs  # shows what partitions are in use as LVMs and to what Volume groups they are assiged
vgs  # summarized version of volume groups gives Volume groups sizes and used space
lvs  # summarized list of Logical volumes in a volume group. Shows names, sizes and attributes

pvdisplay # Extended version of pvs, shows much more inforamtion
vgdisplay # # Extended version of vgs, shows much more inforamtion
lvdisplay # Extended version of lvs, shows much more inforamtion

Disk Space Checking

Find dirs with lots of large files

this link has a list of commands to help find large files

Finds all directories containing more than 99MB of files, and prints them in human readable format. The directories sizes do not include their subdirectories, so it is very useful for finding any single directory with a lot of large files.

# du -mS /|grep '^[0-9]\{3,\}'

== list largest directories in a folder

# du -h --max-depth=1 /folder | sort -hr

Find 20 biggest directories on the current filesystem

# du -xk | sort -n | tail -20

or

# du -a /home | sort -n -r | head -n 20

Find biggest files

This command will find the biggest files recursively under a certain directory, no matter if there are too many.

# find . -type f -printf '%20s %p\n' | sort -n | cut -b22- | tr '\n' '\000' | xargs -0 ls -laSr

Directory Tree Sorted by GB, MB, KB then B

# du -b --max-depth 1 | sort -nr | perl -pe 's{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($1, "")}e'

Getting Disk usage details

Want disk usage per dir on a Linux? Try:

# du -h --exclude=/proc --max-depth=1 /