3

As shown in the picture below, I've created partitions on two 32GB devices: an SD-card, and a flash usb stick.

I intended to create file systems using the entire partition in each case, yet somehow I've failed:

On sdb, /dev/sdb1 is 29.8GB, yet the file system is only 1023MB.
The SD card, mmcblk0p2, is 30GB, but /dev/mmcblk0p2 is only 1.9GB.

How can I rectify this?

enter image description here

1

1 Answer 1

8

If the partition is larger than the filesystem, you can use resize2fs to expand it:

If size parameter is not specified, it will default to the size of the partition.

So it'd just be

[#]> resize2fs /dev/sdb1
4
  • Thanks, Xiong! I tried this, and it worked for the SD-card file system, but not for the USB drive. "resize2fs: Bad magic number in super-block while trying to open /dev/sdb1 Couldn't find valid filesystem superblock." Any thoughts?
    – Jack
    Mar 18, 2016 at 5:45
  • What filesystem is /dev/sdb1? Can you run df -T? Mar 18, 2016 at 5:57
  • Looks like FAT (vfat).
    – Jack
    Mar 18, 2016 at 6:09
  • 3
    resize2fs only works on ext-family filesystems. I can find some reports of fatresize and parted working to resize not just the partition, but the filesystem as well, but I haven't tried either of these. Mar 18, 2016 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .