Skip to content

Instantly share code, notes, and snippets.

@Holzhaus
Created May 12, 2014 13:36
Show Gist options
  • Save Holzhaus/da24a9a15aa1a2f105f0 to your computer and use it in GitHub Desktop.
Save Holzhaus/da24a9a15aa1a2f105f0 to your computer and use it in GitHub Desktop.
mkfs.ext4 for large file drives
#!/bin/sh
if [[ $UID -ne 0 ]]; then
echo "$0 must be run as root."
exit 1
fi
if [[ $# -ne 2 ]]; then
echo "Invalid number of arguments."
echo "Usage: $0 BLK_DEV LABEL"
exit 2
fi
if [[ -e $1 ]]; then
echo "File $1 does not exist."
exit 3
fi
if [[ -b $1 ]]; then
echo "File $1 is not a block device."
exit 4
fi
mkfs.ext4 -I 256 -b 4096 -L $2 -O has_journal,ext_attr,sparse_super,resize_inode,dir_index,filetype,extent,flex_bg,large_file,huge_file,uninit_bg,dir_nlink,extra_isize $1
tune2fs -m 0.0 $1
fsck -fDp $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment