I´m trying to expand an SD that´s running on a Raspberry Pi. The original SD was 8Gb. I saved it to PC with Win32DiskImager, then wrote a new 32Gb SD from that image, and run the file expand option in raspi-config. The total size is still in the 8Gb area.
This is the SSH output after running raspi-config:
Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): Disk /dev/mmcblk0: 28.9 GiB, 31016878080 bytes, 60579840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9a7af20d
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 532480 60579839 60047360 28.6G 83 Linux
Command (m for help): Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (2048-60579839, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (532480-60579839, default 60579839):
Created a new partition 2 of type 'Linux' and of size 28.6 GiB.
Partition #2 contains a ext4 signature.
Command (m for help):
Disk /dev/mmcblk0: 28.9 GiB, 31016878080 bytes, 60579840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9a7af20d
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 532480 60579839 60047360 28.6G 83 Linux
Command (m for help): The partition table has been altered.
Syncing disks.
My df -h looks like this (I have a 1.5Gb RAM disk):
Filesystem Size Used Avail Use% Mounted on
/dev/root 6.8G 4.5G 2.0G 69% /
devtmpfs 779M 0 779M 0% /dev
tmpfs 908M 0 908M 0% /dev/shm
tmpfs 908M 8.6M 900M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 908M 0 908M 0% /sys/fs/cgroup
tmpfs 1.5G 8.0K 1.5G 1% /home/x1/dh2sg/fsram
/dev/mmcblk0p1 253M 54M 199M 22% /boot
tmpfs 182M 0 182M 0% /run/user/1001
I have tried:
# cd /boot # sudo resize2fs /dev/mmcblk0p2
which gives me:
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
resize2fs: Permission denied to resize filesystem
so I-ve tried:
# sudo umount -l /dev/mmcblk0p2
# resize2fs /dev/mmcblk0p2
which returns:
resize2fs 1.44.5 (15-Dec-2018)
ext2fs_check_mount_point: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/mmcblk0p2 is mounted.
As far as I can see, mtab is there:
$ ls -lrt /etc/mtab
lrwxrwxrwx 1 root root 19 Aug 20 2020 /etc/mtab -> ../proc/self/mounts
$ ls -lrt /proc/mounts
lrwxrwxrwx 1 root root 11 Oct 16 19:21 /proc/mounts -> self/mounts
and this the full contents of /etc/mtab:
/dev/root / ext4 rw,noatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=797592k,nr_inodes=103885,mode=755 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,relatime 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=31,pgrp=1,timeout=0,minproto=5,maxproto=5,direct 0 0
sunrpc /run/rpc_pipefs rpc_pipefs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
tmpfs /home/x1/dh2sg/fsram tmpfs rw,nosuid,nodev,relatime,size=1536000k 0 0
/dev/mmcblk0p1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
tmpfs /run/user/1001 tmpfs rw,nosuid,nodev,relatime,size=185936k,mode=700,uid=1001,gid=1001 0 0
gvfsd-fuse /run/user/1001/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1001,group_id=1001 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
Any ideas on what could be wrong?
raspi-config
then selectAdvanced Options
- first choice should beExpand Filesystem
– Bravo Oct 17 '21 at 22:16