Posted
Filed under Computer/Linux
Install CentOS 7 

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
UUID=F10D-3C64  /boot vfat    defaults,noatime 0 0
UUID=2fd27705-271d-4059-ae11-247ac8f2efde  swap swap    defaults,noatime 0 0
---------------Change to below-------------------
/dev/mmcblk0p4  / ext4    defaults,noatime 0 0
UUID=F10D-3C64  /boot vfat    defaults,noatime 0 0
UUID=2fd27705-271d-4059-ae11-247ac8f2efde  swap swap    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

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.
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       113G  3.2G  104G   3% /
devtmpfs        430M     0  430M   0% /dev
tmpfs           463M     0  463M   0% /dev/shm
tmpfs           463M   13M  451M   3% /run
tmpfs           463M     0  463M   0% /sys/fs/cgroup
/dev/mmcblk0p1  286M   55M  231M  20% /boot
tmpfs            93M   12K   93M   1% /run/user/42
tmpfs            93M     0   93M   0% /run/user/1000
tmpfs            93M     0   93M   0% /run/user/1001

$ cat /proc/swaps
Filename Type Size Used Priority
/dev/mmcblk0p2                          partition 499708 4352 -2
/dev/mmcblk0p3                          partition 3906556 0 -3

I tested many OS. but mine case, CentOS 7 is better than others.
2021/01/06 10:15 2021/01/06 10:15
[로그인][오픈아이디란?]