All Projects → EugenMayer → parted-auto-resize

EugenMayer / parted-auto-resize

Licence: MIT License
Automatically or non-interactive resize a partition to its maximum, e.g. for LVM pv resizing when using a partition as PV

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to parted-auto-resize

vmdashboard
web-based open source virtualization management interface for QEMU and KVM virtual machines
Stars: ✭ 66 (+20%)
Mutual labels:  hypervisor
prl guest to host
Guest to host VM escape exploit for Parallels Desktop
Stars: ✭ 26 (-52.73%)
Mutual labels:  hypervisor
codezero
Codezero Microkernel
Stars: ✭ 93 (+69.09%)
Mutual labels:  hypervisor
kube-lvm-flexvolume
Enhanced LVM flexVolume driver for Kubernetes
Stars: ✭ 14 (-74.55%)
Mutual labels:  lvm
alpine-linux-scripts
Alpine Linux Setup Scripts
Stars: ✭ 38 (-30.91%)
Mutual labels:  lvm
devops-kb
frequently used commands
Stars: ✭ 27 (-50.91%)
Mutual labels:  lvm
Invtero.net
inVtero.net: A high speed (Gbps) Forensics, Memory integrity & assurance. Includes offensive & defensive memory capabilities. Find/Extract processes, hypervisors (including nested) in memory dumps using microarchitechture independent Virtual Machiene Introspection techniques
Stars: ✭ 237 (+330.91%)
Mutual labels:  hypervisor
Microverse
macOS virtualization app for M1/Apple Silicon
Stars: ✭ 71 (+29.09%)
Mutual labels:  hypervisor
gokvm
KVM based tiny x86 hypervisor written in pure golang, which can boot Linux
Stars: ✭ 82 (+49.09%)
Mutual labels:  hypervisor
Hypervisor
Hypervisor implementation for x86_64 ISA MIT JOS
Stars: ✭ 25 (-54.55%)
Mutual labels:  hypervisor
bitvisor-gdb
gdbserver implementation on BitVisor
Stars: ✭ 23 (-58.18%)
Mutual labels:  hypervisor
ltzvisor
LTZVisor: a Lightweight TrustZone-assisted Hypervisor
Stars: ✭ 64 (+16.36%)
Mutual labels:  hypervisor
wiser
🐎 Extremely minimal vmm for linux written in C. Hopefully someday will spin linux-vm for you.
Stars: ✭ 249 (+352.73%)
Mutual labels:  hypervisor
frakti
The hypervisor-based container runtime for Kubernetes.
Stars: ✭ 669 (+1116.36%)
Mutual labels:  hypervisor
RVM
Rcore Virtual Machine
Stars: ✭ 59 (+7.27%)
Mutual labels:  hypervisor
sonar
A Type-1 hypervisor aimed to implement kernel hotswapping
Stars: ✭ 23 (-58.18%)
Mutual labels:  hypervisor
uvmm
Virtual machine monitor for L4Re
Stars: ✭ 22 (-60%)
Mutual labels:  hypervisor
prpl-hypervisor
prplHypervisor™
Stars: ✭ 30 (-45.45%)
Mutual labels:  hypervisor
ShotHv
ShotHv
Stars: ✭ 55 (+0%)
Mutual labels:  hypervisor
lvmd
LVMd – the gRPC Wrapper for LVM
Stars: ✭ 26 (-52.73%)
Mutual labels:  lvm

WAT

in short resize a partition non-interactive to its maximum size

The long story..

Since using fdisk in this case is pretty complicated due to the case that non-interactive ways are probably not possible or very complicated using printf, i want to use parted resizepart for resizing a partition to its maximum size.

This can be used in scenarios like disk-resizes ( hypervisor / virtualization ). Now you need to adjust your logical volume / pv to the new size (LVM case) or you want to adjust the partition size of a normal partition.

So lets assume i want to resize partition /dev/sda1 on disk /dev/sda to its maximum possible size - how would i do this without getting asked any questions at all.

Eventhough parted /dev/sda resizepart 1 exists, it needs me to calculate and enter the maximum disk size - so how to automate this would be the next question - and the answer was the reason parted auto resize has been written.

Installation

  curl -o /usr/local/bin/resize.sh https://raw.githubusercontent.com/EugenMayer/parted-auto-resize/master/resize.sh

Dependencies

  • parted 3.0 or higher (otherwise probably rename parted resizepart to parted resize)

Usage

Save the script above as resize.sh and make it executable

# resize the fourth partition to the maximum size, so /dev/sda4
# this is the sandbox mode, so no changes are actually done - just previewed
./resize.sh /dev/sda 4

# apply those changes
./resize.sh /dev/sda 4 apply

Scenarios / motivation

Since debian does not allow you to preseed a LVM configuration, which uses a disk as a pv / vg, but always force you to use a partition, you need a convinient way to resize the pv partition, so you can resize any logical volumes. It can be done using fdisk, but this needs ot be done by hand, interactive with a lot more steps ( usual delete / create / set type to Linux LVM / write / reload partition table

Assuming your pv / vg is created on /dev/sdb1 named vgdata and the LV to resize is named data and you resized your disk using your hypervisor.

Now using this script, all you do is

./resize.sh /dev/sdb 1 apply
pvresize /dev/sdb1
lvextend -r /dev/mapper/vgdata-data -l '+100%FREE'

thats it! Note, if you happen to notice -r in lvextend, yes thats pretty cool, it calls resize2fs /dev/mapper/vgdata-data for us automatically after the partition resize ( to adjust the filesystem size )

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].