How to set or grow partitions on an 8TB drive attached to my LibreElec raspberry pi 4b?

  • I upgraded the firmware of my RPi4b to the 6/15 update that supports booting from USB. I then used BalenaEtcher to put the latest LibreElec image on it. The end result was a 537MB fat16 boot partition, and a 33.6MB ext4 partition that appears to be mounted as /storage.

    How can I expand "/storage" to take the entire 8TB drive instead of just a tiny chunk of it? I want it to host my entire movie collection.


    Thanks much!

  • I use parted and resize2fs.

    both included in libreelec and accessible via ssh.

    Call parted and then use the following commands:

    select (to select your disk /dev/sda ?)

    print (show the size of the disks and partitions)

    resizepart (to resize the partition to the new size)

    quit

    Then call resize2fs following the partition path (probably /dev/sda2, but you should validate-it yourself )

    resize2fs /dev/sda2

    reboot


    Warning: You must be very careful using these tools, as you mich loose everything in your disk.

    Post back your results

  • Thanks for the quick reply!

    I'm booted off of the 8TB drive, and that is the ONLY drive in the system. No SD card at all.

    Given this information, what parameters should I use for the parted resizepart command?

    When I tried rebooting with an SD card running full blown Raspbian, I tried using the gparted command. That failed, because it said the partition was too big for the "msdos" partition table. It appears that I need to convert to the "gpt" type partition table? Is that right? How do I do that and not lose the content of the drive?

    alternatively, can I do a clean install of Raspbian that takes advantage of the whole drive without having to do all this messy drive resizing afterwards? I haven't done anything with the Kodi on this yet, so nothing to lose but the time of reinstalling.

  • When I tried rebooting with an SD card running full blown Raspbian, I tried using the gparted command. That failed, because it said the partition was too big for the "msdos" partition table. It appears that I need to convert to the "gpt" type partition table? Is that right? How do I do that and not lose the content of the drive?

    Hello!

    If you want to use g(ui)parted you have to Install it first.

    Raspian command Line:

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install gparted

    Sudo startx (gparted needs root)

    Then Run gparted

    Regards

    Nicolas

    • Official Post

    All you need(ed) to do is/was boot the LE image before trying to copy media to the drive. If the 32k partition contains /storage/.please_resize_me boot scripts detect it, remove the 32k partition, and a new one created at 100% size.

  • I know this is not a solution to your question, but I don't really understand why you don't use a small usb for booting, & the 8TB usb separately for storage.

    What happens, if you get it all up & running the way you asked, & you need to upgrade, do you have to start again repartitioning?

  • All you need(ed) to do is/was boot the LE image before trying to copy media to the drive. If the 32k partition contains /storage/.please_resize_me boot scripts detect it, remove the 32k partition, and a new one created at 100% size.

    I never copied media to the drive. The drive did resize, but only to the max size supported by the "msdos" partition table type. I think it needs to format the drive using the "gpt" table type instead, so it can support larger partition types.

  • Parted is a great tool, but some are a little scared of the command line.

    An alternative would be to grab a linux ISO and put it on a USB stick, boot it and use Gparted to do it graphically.

    It is a great and easy to use tool (and yes, resizing and moving partitions always carries risk)

  • That is true when running on a PC.

    But having libreelec running in a RPi4 (as the case), and accessing it by ssh, parted and resizefs are already installed. No downloads, no installs, no other boots.


    Or follow chewitt proposal above, for an even easier approach.

  • I never copied media to the drive. The drive did resize, but only to the max size supported by the "msdos" partition table type. I think it needs to format the drive using the "gpt" table type instead, so it can support larger partition types.

    That sounds like it could be a problem limiting your partition size, but DOS partition tables support up to 2TB drives, so it doesn't explain why it would only be 33.6MB. Something else is going on here.

    I'm sure you could partition a drive using GUID and manually copy the partitions into it, but then you'd likely need to reconfigure GRUB which would be a pain.

    I know this is not a solution to your question, but I don't really understand why you don't use a small usb for booting, & the 8TB usb separately for storage.

    What happens, if you get it all up & running the way you asked, & you need to upgrade, do you have to start again repartitioning?

    I second this. This is a much better approach. Much simpler, and long term resilient.

    Or better yet, rather than local storage, use a NAS and mount network drives :P