disko
disko copied to clipboard
Reduce partition size without losing data
I recently installed NixOS with disko and set the root partition to 100%. Now I need to make it smaller. I tried making it 300G and running sudo nix run github:nix-community/disko/latest -- --mode mount nix/nixos-modules/system/disko.nix but it had no effect. Then I saw #568. After looking at it, I realized I need to run sudo nix run github:nix-community/disko/latest -- --mode format --dry-run nix/nixos-modules/system/disko.nix. I did that and decided to look at the resulting script. I saw the following
if ! blkid "/dev/disk/by-id/ata-Samsung_SSD_870_EVO_500GB_S5Y1NJ1R152925A" >&2; then
sgdisk --clear "/dev/disk/by-id/ata-Samsung_SSD_870_EVO_500GB_S5Y1NJ1R152925A"
fi
I don't understand, will my drive be formatted in the end? I really don't want to lose my data.