gpt-formatting-drives-under-linux.md (796B)
1 --- 2 title: "GPT formatting new drives under Linux" 3 date: 2018-11-14T10:42:00 4 tags: ["Guides", "Linux", "Servers", "Snippets"] 5 --- 6 7 So, you've bought a shiny new hard drive and would like to format it and use it on your headless Linux server. 8 For this guide, we'll be partitioning it as a GPT partition to support sizes over 2TB, and formatting it as ext4. 9 10 Find device id (/dev/sdc, etc): 11 ``` 12 lsblk 13 ``` 14 15 Edit the drive, using fdisk in GPT mode with: 16 ``` 17 sudo gdisk /dev/sdc 18 d 19 n 20 [enter] x5 21 w 22 ``` 23 24 Make a partition: 25 ``` 26 sudo mkfs.ext4 /dev/sdc1 27 ``` 28 29 Verify everything formatted correctly: 30 ``` 31 lsblk --fs /dev/sdc1 32 ``` 33 34 Find the drives new UUID: 35 ``` 36 blkid /dev/sdc1 37 ``` 38 39 Lastly, add a mountpoint to `/etc/fstab`: 40 ``` 41 UUID=00000000-0000-0000-0000-000000000000 /mnt/mount-point ext4 defaults 0 0 42 ```