skip to Main Content

I am running a fresh installation of CentOS 7.7. on my Raspberry Pi 3 and unfortunatly I am running out of size when installing yum packages:

[root@centos7 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.4G  1.3G  104M  93% /
devtmpfs        459M     0  459M   0% /dev
tmpfs           464M     0  464M   0% /dev/shm
tmpfs           464M   12M  452M   3% /run
tmpfs           464M     0  464M   0% /sys/fs/cgroup
/dev/mmcblk0p1  286M   57M  230M  20% /boot
tmpfs            93M     0   93M   0% /run/user/0

The OS is installed on a 16gb SD card, so in principle I should have more than enough space:

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        8192      593919      292864    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          593920     1593343      499712   82  Linux swap / Solaris
/dev/mmcblk0p3         1593344     4524031     1465344   83  Linux

I figured that I should be able to increase the size of the file system with growpart or resize2fs but I am not sure how to do this exactly and I don’t want to break anything. What would be the best way to do this? Thanks!

2

Answers


  1. Well, this is an easy thing to do. I share with you my script to extend the /, https://github.com/sbaiidrissiyoussef/STORAGE/blob/master/extend_slash.sh

    Upvote if this helps you.

    Login or Signup to reply.
  2. You are on the right track. This is what I did for my Pi4 on a 64GB SD card:

    [root@localhost ~]# df -h | head -n 2
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/root       1.7G  1.4G  199M  88% /
    
    [root@localhost ~]# fdisk -l
    ...
            Device Boot      Start         End      Blocks   Id  System
    /dev/mmcblk0p1   *        8192      593919      292864    c  W95 FAT32 (LBA)
    /dev/mmcblk0p2          593920     1593343      499712   82  Linux swap / Solaris
    /dev/mmcblk0p3         1593344     5109759     1758208   83  Linux
    
    [root@localhost ~]# growpart /dev/mmcblk0 3
    CHANGED: partition=3 start=1593344 old: size=3516416 end=5109760 new: size=120041439 end=121634783
    [root@localhost ~]# fdisk -l
    ...
            Device Boot      Start         End      Blocks   Id  System
    /dev/mmcblk0p1   *        8192      593919      292864    c  W95 FAT32 (LBA)
    /dev/mmcblk0p2          593920     1593343      499712   82  Linux swap / Solaris
    /dev/mmcblk0p3         1593344   121634782    60020719+  83  Linux
    
    [root@localhost ~]# resize2fs /dev/mmcblk0p3 
    resize2fs 1.42.9 (28-Dec-2013)
    Filesystem at /dev/mmcblk0p3 is mounted on /; on-line resizing required
    old_desc_blocks = 1, new_desc_blocks = 8
    The filesystem on /dev/mmcblk0p3 is now 15005179 blocks long.
    
    [root@localhost ~]# df -h | head -n 2
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/root        57G  1.4G   55G   3% /
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search