Correctly report usage of absolutely full NTFS (#697946)
For an absolutely full NTFS GParted doesn't show the file system usage but instead shows a warning against the partition. GParted was looking only for "resize at %d" to determine file system used figure in the output from the ntfsresize command. Also handle finding "ERROR: Volume is full" too to derive used figure. NTFS with 1 block free case: # ntfsresize --info --force --no-progress-bar /dev/sda9 ... Current volume size: 1073738240 bytes (1074 MB) ... Collecting resizing constraints ... You might resize at 1073737728 bytes (freeing 4096 bytes). ... # echo $? 0 Absolutely full NTFS case: # ntfsresize --info --force --no-progress-bar /dev/sda9 ... Current volume size: 1073738240 bytes (1074 MB) ... Collecting resizing constraints ... ERROR: Volume is full. To shrink it, delete unused files. # echo $? 1 Closes Bug #697946 - Absolutely full NTFS reported as partition error
This commit is contained in:
parent
76a9cd3c93
commit
50ca2e5f13
10
src/ntfs.cc
10
src/ntfs.cc
|
@ -110,8 +110,9 @@ FS ntfs::get_filesystem_support()
|
|||
|
||||
void ntfs::set_used_sectors( Partition & partition )
|
||||
{
|
||||
if ( ! Utils::execute_command(
|
||||
"ntfsresize --info --force --no-progress-bar " + partition .get_path(), output, error, true ) )
|
||||
exit_status = Utils::execute_command(
|
||||
"ntfsresize --info --force --no-progress-bar " + partition .get_path(), output, error, true ) ;
|
||||
if ( exit_status == 0 || exit_status == 1<<8 )
|
||||
{
|
||||
index = output .find( "Current volume size:" ) ;
|
||||
if ( index >= output .length() ||
|
||||
|
@ -122,6 +123,11 @@ void ntfs::set_used_sectors( Partition & partition )
|
|||
if ( index >= output .length() ||
|
||||
sscanf( output .substr( index ) .c_str(), "resize at %Ld", &N ) != 1 )
|
||||
N = -1 ;
|
||||
//For an absolutely full NTFS, "ntfsresize --info" exits
|
||||
// with status 1 and reports this message instead
|
||||
index = output .find( "ERROR: Volume is full" ) ;
|
||||
if ( index < output .length() )
|
||||
N = T ;
|
||||
|
||||
if ( T > -1 && N > -1 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue