Differences between revisions 3 and 4
Revision 3 as of 2022-04-06 09:52:45
Size: 1894
Editor: Burathar
Comment:
Revision 4 as of 2022-04-06 09:53:35
Size: 1901
Editor: Burathar
Comment:
Deletions are marked like this. Additions are marked like this.
Line 34: Line 34:
Source: www.devops-engineer.com/how-to-create-linux-lvm-step-by-step/ Source: http://www.devops-engineer.com/how-to-create-linux-lvm-step-by-step/

Modifying partitions

Run this lsblk command to get a clear overview of all your disks and partitions

lsblk -o KNAME,TYPE,FSTYPE,SIZE,LABEL,VENDOR,MODEL

Find the disk you want to modify, and take note of its kname. Note: names like sda, sdb and sdc represent disks. Names ending in a number like sda1, sda2 or sdb1 represent partitions.

Replace sda with the diskname/kname you want to modify. (so not a partition on that disk)

sudo cfdisk /dev/sda

This will open a cli UI where you can select, modify, delete, and create partitions. Also make sure to select the right partition type. Finally write the new config to disk, and quit

Alternativeley, fdisk can be used, this is a less interactive tool.

sudo fsdisk /dev/sda
p (optional: print current table)
g (Create GPT partion table on new disks)
n (Create a new partition, select first and last sector)
t (Change partition type, follow instructions)
p (optional: print)
w (write configuration to disk)

LVM

Source: http://www.devops-engineer.com/how-to-create-linux-lvm-step-by-step/

To setup LVM:

  1. Create at least a single partition with partition type Linux LVM

  2. Initialize physical volume: pvcreate /dev/sda1 (Optional, vgcreate will do this automatically)

  3. Create a volume group vgcreate -s 16M vg0 /dev/sda1

  4. Create a logical volume with maximum size lvcreate -n lvol0 -l 100%FREE vg0

  5. Intialize the filesystem mkfs.ext4 /dev/mapper/vg0-lvol1

  6. (Mount the new partition mount /dev/mapper/vg0-lvol0 PATH, or add it to fstab)

Initializing a filestystem

To create a filesystem on a partition you can use mkfs utils, for instance mkfs.ext4 or mkfs.exfat. Obviously, replace the Volume Label name and partition name

sudo mkfs.exfat -n 'Volume Label' /dev/sda1

Howto/DiskManagement (last edited 2023-01-20 11:29:35 by Burathar)