From dc2545a1938a4db36b23045829284783d8cd3d17 Mon Sep 17 00:00:00 2001 From: Yuri Slobodyanyuk Date: Wed, 24 Mar 2021 17:56:44 +0000 Subject: [PATCH] ongoing additions, changes, and fixes --- FreeBSD-cheat-sheet.adoc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/FreeBSD-cheat-sheet.adoc b/FreeBSD-cheat-sheet.adoc index 8dba263..7ddf835 100644 --- a/FreeBSD-cheat-sheet.adoc +++ b/FreeBSD-cheat-sheet.adoc @@ -30,8 +30,32 @@ Author: Yuri Slobodyanyuk, admin@yurisk.info |Show partitions, similar to `geom part list` minus labels information, so is shorter. Add `-r` to show GPT partition types, see for the complete list at https://en.wikipedia.org/wiki/GUID_Partition_Table . +|*gpart recover * +|Recover partition information, e.g. when increasing the size of already partitioned disk in Virtual Machine, the last sector holding the partition info is lost, so to put the needed info in the last sector of now increased disk: `gpart recover da0`. +|*swapoff * +|Turn off temporarily the swap file, e.g. to move its partition to the end of the increased virtual disk: `swapoff /dev/da0p3` +|*gpart delete -i * +|Delete partition number `n` (as shown by `gpart show`) on the device `device name`. E.g. If the swap partition was number 3 on disk /dev/da0, to delete it: `gpart delete -i 3 /dev/da0`. + +|*gpart create -s * +|Set type of partition to be added on device `device name`. E.g. to set up device _da1_ for GPT partitioning: `gpart create -s gpt da1`. + +|*sysctl kern.geom.debugflags=16* +|Resizing a live partition may require turning off this protection. + +|*gpart resize -i [ -s ] [-a ] * +|Resize existing partition number `n` to `new size`, optionally setting alighnment, on device `device name`. If `-s` size is not given, use up all available _free_ space. E.g. to increase the _2nd_ partition on device _da0_ to 47 Gigabyte with 4k alignment: `gpart resize -i 2 -s 47G -a 4k da0`. + +|*growfs * +|After resizing a partition, grow the existing file system on it to encompass the new free space. E.g.`growfs /dev/da0p2`. + +|*gpart add -t [-a ] [-l