Download Raspberry PI OS from
http://mirror.keystealth.org/centos-altarch/7.9.2009/isos/armhfp/CentOS-Userland-7-armv7hl-RaspberryPI-GNOME-2009-sda.raw.xz
Download Raspberry PI Imager from https://www.raspberrypi.org/blog/raspberry-pi-imager-imaging-utility/
Select "CentOS-Userland-7-armv7hl-RaspberryPI-GNOME-2009-sda.raw.xz" file at Operating System button. ( "Use custom" at the bottom )
Insert SD Card at the USB reader then you can see the SD card at the "SD Card"
Click "Write" button.
This CentOS7 os defined 3.5GB filesystem at the SD Card. (partition 3 : / (3G) , 2: swap(500M), 1:/boot)
So, you can modify the filesystem as fit your own SD Card.
Insert your SD Card on your linux machine
If your SD Card device is /dev/sdb then.....
Make a extra partition at the free space
# fdisk /dev/sdb
n
9406464
wq
Format the new device (/dev/sdb4)
# mkfs.ext4 /dev/sdb4
Mount partitions
# mkdir /mnt/boot
# mkdir /mnt/root
# mkdir /mnt/new_root
# mount /dev/sdb1 /mnt/boot
# mount /dev/sdb3 /mnt/root
# mount /dev/sdb4 /mnt/new_root
Copy whole filesystems to new partition
# cd /mnt/root
# rsync -a --progress . /mnt/new_root
Modify the root device definition at the kernel parameter
# vi /mnt/boot/cmdline.txt
-----------------------------------------------------
console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait
---------------Change to below-------------------
console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p4 rootfstype=ext4 elevator=deadline rootwait
------------------------------------------------------
Modify the root partition at the fstab
# vi /mnt/new_root/etc/fstab
-----------------------------------------------------
UUID=125a472a-16a7-4c65-af22-ca19632sc8fa / ext4 defaults,noatime 0 0
-----------------------------------------------------
Disable selinux
# vi /mnt/new_root/etc/selinux/config
Change from enforcing to disabled
Unmount
# umount /mnt/boot /mnt/new_root /mnt/root
Insert the SD Card to Raspberry PI.
You can now use the big root filesystem on your SD Card.
If you want increase the swap partition then change the old root partition to swap partition
Make a swap partition at the old root device
$ sudo fdisk /dev/mmcblk0
t
3
82
wq
$ sudo mkswap /dev/mmcblk0p3
Add a line at the /etc/fstab file with UUID information
$ sudo vi /etc/fstab
UUID=1251472a-16a7-4c25-af22-ca1964ac8fd0 swap swap defaults,noatime 0 0
$ sudo swapon /dev/mmcblk0p3
Now you can use big swap and big filesystem.
I tested many OS. but mine case, CentOS 7 is better than others.