I have followed Cloning an SD card onto a larger SD card to clone a 2G SD card to a 32G SD card, and the file system is ext4. However, on the 32G SD card I only can see 2G space available. Is there a way to maximize it out? Here is the output of fdisk:
Command (m for help): p
Disk /dev/sdb: 32.0 GB, 32026656768 bytes
64 heads, 32 sectors/track, 30543 cylinders, total 62552064 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
Disk identifier: 0x000e015a
Device Boot Start End Blocks Id System
/dev/sdb1 * 32 147455 73712 c W95 FAT32 (LBA)
/dev/sdb2 147456 3994623 1923584 83 Linux
I want to make /dev/sdb2 use up the remaining space. I try resize2fs /dev/sdb after dd, but get message below:
$ sudo resize2fs /dev/sdb
resize2fs 1.42 (29-Nov-2011)
resize2fs: Bad magic number in super-block while trying to open /dev/sdb
Couldn't find valid filesystem superblock.
Any idea on what I am doing wrong? Thanks.
Edit 1
Now I use gparted to resize the sd card, and it works. I think it's possible to do this in command line. In my example, you should umount /dev/sdb2 first, then resize2fs /dev/sdb2 I guess. At least in gparted GUI I need to umount /dev/sdb2 first.
Edit 2
Reboot will cause "init not found" error. Even if I specify init path, it doesn't find /root/dev/console then kernel panic. Error message below:
/init: line 352: can't open /root/dev/console: no such file
resize2fs /dev/sdb2shows me: "The filesystem is already 1923584 blocks long. Nothing to do!". I guess I need to modify partition table first? – chenwj Sep 21 '12 at 03:01resize2fs /dev/sdb2on an unmounted filesystem (after resizing withpartedstill produces "Bad magic number in super-block while trying to open /dev/sdb2") – Doktor J Apr 20 '20 at 15:12