Technical stuff, mostly to remind myself when I forget in a couple of months' time.

Sunday, 2 March 2014

Partitioning and formatting a 4TB disk

Amazing what just over a ton will get you these days - 4 TB of disk. I know it makes me sound old but I remember having a 10 MB disk and being pleased ...

Anyway, setting it up wasn't difficult but I didn't find a single consolidated guide to do what I wanted, which was to create two ext4 partitions, one normal and one encrypted with LUKS, for personal information. So here's what I did.

Partition the disk
Anything over 2TB is not supported by the venerable MBR, so the newer GPT partitioning scheme is needed, which in turn requires the use of a partitioning tool that supports GPT. I used parted (which I had to install first), like so:

# parted /dev/sdc
> unit %
> mklabel gpt
> mkpart primary 0 50
> mkpart primary 50 100
> print
> quit

Create file systems
1) The normal partition
# mkfs.ext4 /dev/sdc1

2) the LUKS parition
# cryptsetup -y -v luksFormat /dev/sdc2
# cryptsetup luksOpen /dev/sdc2 d2
# mkfs.ext4 /dev/mapper/d2

Reduce amount of system space
ext4 reserves 5% of the disk for system space by default, which on a 2TB volume is 100GB. This is excessive for volumes that just contain data and not any OS files. The following commands reduce this allocation to 1% and free up about 80GB of space.

# tune2fs -m 1 /dev/sdc1
# tune2fs -m 1 /dev/mapper/h2


Then mount in your preferred location and away you go!

No comments:

Post a Comment

Your Host

Husband, father, pop music anorak, guitarist