Skip to content

Instantly share code, notes, and snippets.

@HirogaKatageri
Last active September 21, 2022 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HirogaKatageri/110d0d238665592de821012d1d518305 to your computer and use it in GitHub Desktop.
Save HirogaKatageri/110d0d238665592de821012d1d518305 to your computer and use it in GitHub Desktop.
Simple Guide for Manual Partition of a Linux System

Simple Commands for Manual Partitioning

Partition Table

fdisk 
  -g GPT Partition
  -l (1,19) (43 if you need LVM)
  -n add partition
  -x advanced options
  -f sort order
  -r return to menu
  -w write

Data Wiping

by Bytes

dd if=/dev/zero of=/dev/sdX bs=${block_size} count=${End - Start} seek=${Start} status=progress

by Sectors

dd if=/dev/zero of=/dev/sdX bs=${block_size} count=${sectors} status=progress

LVM Partitioning

  • pvcreate /dev/sdX ...

  • vgcreate ${group_name} /dev/sdX /dev/sdX create volume group

  • lvcreate -L ${size} -t ${group_name} -n ${name} create logical volume

Remove Volume Group

  • vgchange -a -n ${group_name} deactivate
  • vgremove ${group_name}

Removing Logical Volume

  • lvs see volumes
  • lsblk see mountpoint
  • lvremove ${volume_group}/${logical_volume}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment