linux:storage
This is an old revision of the document!
Table of Contents
Linux Storage
This page contains my personal notes on Linux filesystems, partitioning, backups, performance tuning, and related concepts. Warning: these notes are specific to my own non-critical systems and may not be applicable in general use cases.
Partitioning for Ubuntu 19.04 workstations
I'm currently the following configuration on my Dell Precision 5520 notebook computer:
- 256GB NVMe drive
- 256MiB EFI partition as a raw FAT partition
- 512MiB /boot partition as a raw ext4 partition
- the rest of the disk is configured as an LVM PV consuming 92% of the drive
- this currently contains one volume group with two logical volumes, 16GiB for swap (to allow hibernate) and the remaining space is used for /
Initializing partitions using gparted
GNU parted manual: https://www.gnu.org/software/parted/manual/parted.html#Using-Parted-1
parted /dev/nvme0n1 print # check to see what's already on the disk before you do anything else mklabel gpt unit MiB # use binary format units when partitioning mkpart efi fat32 1MiB 257MiB # align the first block mkpart boot ext4 257MiB 769MiB mkpart pv0 ext4 769MiB 92% # finish the LVM pv at 92% capacity
If this worked you will see something like this when you print the partition table
(parted) print Model: PC401 NVMe SK hynix 256GB (nvme) Disk /dev/nvme0n1: 244198MiB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1.00MiB 513MiB 512MiB fat32 efi 2 513MiB 1025MiB 512MiB ext4 boot 3 1025MiB 224662MiB 223637MiB ext4 pv0
As far as I can tell parted can't label volumes as Linux LVM, so I do that using fdisk.
root@kubuntu:~# fdisk /dev/nvme0n1 Welcome to fdisk (util-linux 2.33.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): t Partition number (1-3, default 3): 3 Partition type (type L to list all types): 31 Changed type of partition 'Linux LVM' to 'Linux LVM'. Command (m for help): p Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 sectors Disk model: PC401 NVMe SK hynix 256GB Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 7393485F-ADF5-46CE-B51A-ECD6083D4AB7 Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1050623 1048576 512M Microsoft basic data /dev/nvme0n1p2 1050624 2099199 1048576 512M Linux filesystem /dev/nvme0n1p3 2099200 460107775 458008576 218.4G Linux LVM Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
Create filesystems and LVM structure
pvcreate /dev/nvme0n1p3 vgcreate vg0 /dev/nvme0n1p3 lvcreate -n swap0 -L 16GiB vg0 lvcreate -n root -l 100%FREE vg0
If you did this correctly you should see the following
lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root vg0 -wi-a----- 202.39g swap0 vg0 -wi-a----- 16.00g
linux/storage.1556648303.txt.gz · Last modified: 2019-04-30 14:18 by gabriel