User Tools

Site Tools


linux:storage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:storage [2019-04-30 13:46] – created gabriellinux:storage [2019-08-10 19:04] (current) – title capitalization gabriel
Line 1: Line 1:
-====== Linux Storage ======+====== 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.// 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.//
 +
 +> **Update:** Due to a a number of stability issues I've returned to using [[https://neon.kde.org/|KDE neon]] on my work laptop.  Nod to the KDE devs for maintaining a stable rolling release distro.  The general principles still apply to any modern distro.
  
 ===== Partitioning for Ubuntu 19.04 workstations ===== ===== Partitioning for Ubuntu 19.04 workstations =====
Line 8: Line 10:
  
   * 256GB NVMe drive   * 256GB NVMe drive
 +  * 256MiB EFI partition as a raw FAT partition
   * 512MiB /boot partition as a raw ext4 partition   * 512MiB /boot partition as a raw ext4 partition
-  * 512MiB EFI partition as a raw FAT partition 
   * the rest of the disk is configured as an LVM PV consuming 92% of the drive   * 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 /   * this currently contains one volume group with two logical volumes, 16GiB for swap (to allow hibernate) and the remaining space is used for /
Line 22: Line 24:
 mklabel gpt mklabel gpt
 unit MiB # use binary format units when partitioning unit MiB # use binary format units when partitioning
-mkpart efi fat32 1MiB 513MiB # align the first block +mkpart efi fat32 1MiB 257MiB # align the first block 
-mkpart boot ext4 513MiB 1025MiB +mkpart boot ext4 257MiB 769MiB 
-mkpart pv0 ext4 1025MiB 92% # finish the LVM pv at 92% capacity+mkpart lvm-pv0 ext4 769MiB 92% # finish the LVM pv at 92% capacity
 </file> </file>
  
Line 32: Line 34:
 (parted) print                                                             (parted) print                                                            
 Model: PC401 NVMe SK hynix 256GB (nvme) Model: PC401 NVMe SK hynix 256GB (nvme)
-Disk /dev/nvme0n1: 244198MiB+Disk /dev/nvme0n1: 256GB
 Sector size (logical/physical): 512B/512B Sector size (logical/physical): 512B/512B
 Partition Table: gpt Partition Table: gpt
 Disk Flags:  Disk Flags: 
  
-Number  Start    End        Size       File system  Name  Flags +Number  Start   End    Size   File system  Name     Flags 
-      1.00MiB  513MiB     512MiB     fat32        efi +      1049kB  269MB  268MB  ext4         efi      msftdata 
-      513MiB   1025MiB    512MiB     ext4         boot +      269MB   806MB  537MB               boot 
-      1025MiB  224662MiB  223637MiB  ext4         pv0+      806MB   236GB  235GB               lvm-pv0  lvm
 </file> </file>
 +
 +As far as I can tell parted can't label volumes as Linux LVM, so I do that using fdisk.
 +
 +<file sh>
 +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 filesystem' 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: 14779AE7-C2BB-4F6A-9F6E-A927FAF7AAFB
 +
 +Device           Start       End   Sectors   Size Type
 +/dev/nvme0n1p1    2048    526335    524288   256M Microsoft basic data
 +/dev/nvme0n1p2  526336   1574911   1048576   512M Linux filesystem
 +/dev/nvme0n1p3 1574912 460107775 458532864 218.7G Linux LVM
 +
 +Command (m for help): w
 +The partition table has been altered.
 +Calling ioctl() to re-read partition table.
 +Syncing disks.
 +</file>
 +
 +=== Create filesystems and LVM structure ===
 +
 +<file sh>
 +pvcreate /dev/nvme0n1p3
 +vgcreate vg0 /dev/nvme0n1p3
 +lvcreate -n swap0 -L 16GiB vg0
 +lvcreate -n root -l 100%FREE vg0
 +</file>
 +
 +If you did this correctly you should see the following
 +
 +<file sh>
 +lvs
 +  LV    VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
 +  root  vg0 -wi-a----- 202.64g                                                    
 +  swap0 vg0 -wi-a-----  16.00g
 +</file>
 +
linux/storage.1556646418.txt.gz · Last modified: 2019-04-30 13:46 by gabriel