Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QStorageInfo in read only rootfs



  • Hi,

    I am using qt revision 5.7.1 on my debian strech system. I have mounted my rootfs as read only ,I have used QStorageInfo to check my SD card size.

    After mounting rootfs as read only i am getting only root directory in QStorageInfo mountedvolumes.

    Below is the source code to get storage list:

    foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) {
        if (storage.isValid() && storage.isReady())
            {
                qDebug() << "storage path" << storage.rootPath();
                qDebug()  << "storage name" << storage.name();
                qDebug()  << "storage readonly" << storage.isReadOnly();
                qDebug()  << "storage filesystem type " << storage.fileSystemType();
                qDebug()  << "storage device " << storage.device();
        }
    }
    

    output of above source :
    storage path "/"
    storage name ""
    storage readonly true
    storage filesystem type ""
    storage device ""

    my /etc/fstab file contain:

    /dev/mmcblk0p1 / ext4 ro,noatime 0 1
    mount_overlay /var fuse nofail,defaults 0 0
    mount_overlay /home fuse nofail,defaults 0 0
    mount_overlay /etc fuse nofail,defaults 0 0
    none /tmp tmpfs defaults 0 0

    If I mount rootfs as "rw" QStorageInfo works fine.

    Please help me understand issue QStorageInfo with readonly rootfs.

    Thanks,
    Jignesh Patel


Log in to reply