You are not logged in.

#1 2022-01-20 16:56:28

mrbang20
Member
Registered: 2022-01-20
Posts: 2

[SOLVED] question on resizing root partition

Hi, I recently installed Arch Linux, I wanted to leave a 50G partition to mount manually for encrypted files, but I forgot.

My current partition scheme is:
sda:
    sda1 - boot
    sda2 - swap
    sda3 - root

Since I already configured Arch, I would like to not install it again.
My question is: is the following procedure going to work like nothing happend to the os?

- cp everything in root into an usb
- remove root partition, make 2 new partition (one is for root again)
- format root partiton
- cp everything back into root
- generate fstab

Last edited by mrbang20 (2022-01-24 18:16:55)

Offline

#2 2022-01-20 17:08:50

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,811
Website

Re: [SOLVED] question on resizing root partition

I just reduce the filesystem size on the root partition with 'btrfs filesystem resize' then use gdisk to delete the root partition and recreate it with a smaller size (matching the new filesystem size) using the same start sector. I've done it a few times now without any problems or need to reboot or edit fstab (which I don't have).

If you like GUIs then it could also be done with GParted (I think).

The only caveat would be the filesystem: for example, XFS doesn't allow for a reduction in size.

EDIT: having said that though a backup should be considered essential. And not just for operations like this smile

Last edited by Head_on_a_Stick (2022-01-20 17:11:28)


Jin, Jîyan, Azadî

Offline

#3 2022-01-20 17:11:19

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,088

Re: [SOLVED] question on resizing root partition

You need to make sure your USB is a POSIX/linux file system as well, ideally the same as your root partition and then you can do something like: https://wiki.archlinux.org/title/Rsync# … tem_backup

That said if your goal is shrinking the root partition you can generally do that without data loss from a live disk (you should still have a backup in case something goes wrong but if it doesn't you can at least avoid an additional copy over). For ease of use I'd suggest you use a gparted live disk to do shrinking operations, if you want to do it manually you just need to shrink the filesystem and then the partition accordingly: https://wiki.archlinux.org/title/Parted … partitions

Offline

Board footer

Powered by FluxBB