LibreElec on RPi4 HDD defrag capability

  • Hi, I have a 4TB HDD attached to my RPI4 running LibreElec (nightlies). It is attached via a powered 3.0 USB hub so doesnt draw power from the RPi. Occasionally the drive is dismounted and stops functioning so I take it out and do an error check and defrag the heavily fragmented drive on my PC. So apparently there is a linux app called e4defrag which could defrag the drive on a daily basis. Is this possible via an app or addon? Any thoughts?

    Thanks

    Chook.

  • If you're de-fragging via a 'PC', is that Windows and is the drive formatted as NTFS? If so, I don't think e4defrag will help much, as that's really for ext3 and ext4 volumes.

    Why not backup the whole drive, format as ext4, then transfer the data back? Ext4 is very good with block allocation and self-defragging.

  • could filesystem "btrfs" in combination with mount option "autodefrag" an option ?

    btw.: does the disk support TRIM ?

    on linux:

    sudo hdparm -I /dev/sdX|grep -i trim

    adjust "X"

    on windoof: driveInfo

    DH DriveInfo

  • It is currently NTFS so I can defrag and or repair on a windows PC. The RPI4 LibreElec OS can use an EXT4 disk format and apparently seldom needs de fragmenting so I understand. I read a similar request a few years back stating there was no demand for this capability. So I may reformat the drive to EXT4 on my Linux laptop and repopulate it on the network. Its quicker than the USB2 ports on the laptop. It's due for a clean out anyhow. I'll drop this query.

    chook