Announcement

Collapse
No announcement yet.

How to expand file system to use the max size of the SD

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to expand file system to use the max size of the SD

    I have a 64GB MicroSD installed and I want to expand to use the full SD card space as I need to download and build QT5 on the target.

    I followed instructions on how to use PARTED to expand the root to the full size but then it reboots I get a kernel panic and an unable to mount root fs on unknown-block(179.2)

    The option in the config to expand the file system only gives me 4GB with about 520MB free.

    If the OS does not support this 64GB card, what is the max size I can use and expand out to?

  • #2
    For reference, I have tried the following on a 16GB card:

    [email protected]:~$ sudo fdisk /dev/mmcblk0

    Welcome to fdisk (util-linux 2.25.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.


    Command (m for help): p
    Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 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: 0x32fc8d6d

    Device Boot Start End Sectors Size Id Type
    /dev/mmcblk0p1 8192 122879 114688 56M c W95 FAT32 (LBA)
    /dev/mmcblk0p2 131072 7372799 7241728 3.5G 83 Linux


    Command (m for help): q

    [email protected]:~$ sudo parted /dev/mmcblk0
    GNU Parted 3.2
    Using /dev/mmcblk0
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) unit chs
    (parted) print
    Model: SD SL16G (sd/mmc)
    Disk /dev/mmcblk0: 1936,229,20
    Sector size (logical/physical): 512B/512B
    BIOS cylinder,head,sector geometry: 1936,255,63. Each cylinder is 8225kB.
    Partition Table: msdos
    Disk Flags:

    Number Start End Type File system Flags
    1 0,130,2 7,165,29 primary fat16 lba
    2 8,40,32 458,238,35 primary ext2

    (parted) rm 2
    Error: Partition(s) 2 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the
    change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You
    should reboot now before making further changes.
    Ignore/Cancel? i
    (parted) print
    Model: SD SL16G (sd/mmc)
    Disk /dev/mmcblk0: 1936,229,20
    Sector size (logical/physical): 512B/512B
    BIOS cylinder,head,sector geometry: 1936,255,63. Each cylinder is 8225kB.
    Partition Table: msdos
    Disk Flags:

    Number Start End Type File system Flags
    1 0,130,2 7,165,29 primary fat16 lba

    (parted) mkpart primary 7,165,30 100%
    Error: Partition(s) 2 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the
    change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You
    should reboot now before making further changes.
    Ignore/Cancel? i
    (parted) print
    Model: SD SL16G (sd/mmc)
    Disk /dev/mmcblk0: 1936,229,20
    Sector size (logical/physical): 512B/512B
    BIOS cylinder,head,sector geometry: 1936,255,63. Each cylinder is 8225kB.
    Partition Table: msdos
    Disk Flags:

    Number Start End Type File system Flags
    1 0,130,2 7,165,29 primary fat16 lba
    2 7,165,30 1936,213,4 primary lba

    (parted) quit
    Information: You may need to update /etc/fstab.

    [email protected]:~$ sudo reboot



    Everything appears to work but it kernel panics on boot.
    Click image for larger version

Name:	kernelpanic.jpg
Views:	37
Size:	307.2 KB
ID:	56540
    Attached Files

    Comment


    • #3
      Hi Dave,

      When re-creating partition, you should start at correct sector

      Number Start End Type File system Flags
      1 0,130,2 7,165,29 primary fat16 lba
      2 8,40,32 458,238,35 primary ext2
      Take note of the beginning sector of the second partition, it starts at 8,40,32

      To create the second partition, it should be:
      (parted) mkpart primary ext2 8,40,32 100%
      After creating the partition, reboot.

      Check the partition size after reboot,
      You will notice that the partition is larger but the root file system has still the old size.

      To resize the root filesystem
      resize2fs /dev/mmcblk0p2
      The root file system should be extended.

      Hope this helps.

      Comment


    • #4
      Well spotted. That allowed me to boot and then you need to use the tools to expand to this partition.

      Hope the above helps someone else?

      Comment

      Working...
      X