2014-03-06 3 views
0

파티션에서 사용되는 섹터를 확인하려고합니다. 하지만 libparted는 ntfs/ext4의 파티션 크기 조정을 지원하지 않는 것으로 보입니다. 코드에서 섹터의 사용량을 알면됩니다.libparted는 사용 된 섹터를 결정합니다.

오류 코드 : "오류 : NTFS 파일 시스템의 크기를 조정은 지원되지 않습니다"

SLPartition::SLPartition(PedPartition *partition, SLDrive *drive) : 
    _pedPartition(0), 
    _drive(0), 
    _mountInfo(QString()), 
    _path(QString()), 
    _name(QString()), 
    _start(0), 
    _end(0), 
    _size(0), 
    _sector(0) 
{ 
    if(partition) 
    { 
     this->_pedPartition = partition; 
     this->_drive  = drive; 
     this->_path   = ped_partition_get_path(partition); 
     this->_name   = QString::number(partition->num); 
     this->_start  = partition->geom.start; 
     this->_end   = partition->geom.end; 
     this->_sector  = partition->geom.length; 
     this->_size   = partition->geom.length/2; 


     qint64 usedSector = -1; 

     PedFileSystem *pedFileSystem = ped_file_system_open(&partition->geom); 

     if(pedFileSystem) 
     { 
      if(PedConstraint* pedConstraint = ped_file_system_get_resize_constraint(pedFileSystem)) 
      { 
       usedSector = pedConstraint->min_size; 
       ped_constraint_destroy(pedConstraint); 
      } 

      ped_file_system_close(pedFileSystem); 
     } 

     qDebug() << usedSector; 

     // TODO MountInfo 
    } 
} 

는 대체 솔루션이 있습니까? 고맙습니다.

답변

0

한 가지 대안은 기계 해석 가능한 출력을 갖는 sfdisk으로 쉘 아웃하는 것입니다.

관련 문제