Add online resize support (#694622)

Many file systems are capable of growing while mounted, and a few can
even shrink.  This support must be explicitly enabled at configure time
with the --enable-online-resize flag and depends on a patched libparted.
Also requires kernel >= 3.6 for partition resizing, even if the
partition is in use (BLKPG_RESIZE_PARTITION).

Thanks to Mike Fleetwood for double check mark idea instead of a second
column to show the online grow/shrink.

Bug #694622 - Add support for online resize
This commit is contained in:
Phillip Susi 2013-11-15 11:27:12 -05:00 committed by Mike Fleetwood
parent 7bebacd8d4
commit de2844d02d
16 changed files with 198 additions and 55 deletions

12
README
View File

@ -112,7 +112,17 @@ b. Building from Source
dmraid support use the --enable-libparted-dmraid flag: dmraid support use the --enable-libparted-dmraid flag:
E.g., ./configure --enable-libparted-dmraid E.g., ./configure --enable-libparted-dmraid
Please note that more than one configure flags can be used: If you wish to build this package with online resize support then
the following is required:
a) A version of libparted that includes the online resize patch.
At time of writing (November 2013), this patch was only
included in Debian and derived distros with parted package
version 2.3-14 or higher.
b) Linux kernel version 3.6 or higher.
Enable with the --enable-online-resize flag:
E.g., ./configure --enable-online-resize
Please note that more than one configure flag can be used:
E.g., ./configure --disable-doc --enable-libparted-dmraid E.g., ./configure --disable-doc --enable-libparted-dmraid
The INSTALL file contains further GNU installation instructions. The INSTALL file contains further GNU installation instructions.

View File

@ -391,6 +391,22 @@ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
dnl======================
dnl check whether to enable online resize support
dnl======================
AC_ARG_ENABLE([online_resize],
[ --enable-online-resize enable online resize support],,)
if test "x${enable_online_resize}" = "x" ; then
enable_online_resize=no
fi
AC_MSG_CHECKING([whether online resize support is enabled])
if test ${enable_online_resize} = yes; then
AC_MSG_RESULT([yes])
AC_DEFINE([ENABLE_ONLINE_RESIZE], [1], [Define to 1 if --enable-online-resize specified])
else
AC_MSG_RESULT([no])
fi
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
@ -418,6 +434,7 @@ echo ""
echo " Build documentation? : $enable_doc" echo " Build documentation? : $enable_doc"
echo "" echo ""
echo " Use native libparted dmraid support? : $enable_libparted_dmraid" echo " Use native libparted dmraid support? : $enable_libparted_dmraid"
echo " Enable online resize support? : $enable_online_resize"
echo "" echo ""
echo " --- Features Based On Libparted Version ---" echo " --- Features Based On Libparted Version ---"
echo " Need partition table re-read work around? : $need_pt_reread_work_around" echo " Need partition table re-read work around? : $need_pt_reread_work_around"

View File

@ -51,7 +51,9 @@ private:
Gtk::TreeModelColumn<Glib::ustring> filesystem; Gtk::TreeModelColumn<Glib::ustring> filesystem;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > create ; Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > create ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > grow ; Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > grow ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > online_grow ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > shrink ; Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > shrink ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > online_shrink ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > move ; Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > move ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > copy ; Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > copy ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > check ; Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > check ;
@ -64,7 +66,9 @@ private:
add( filesystem ); add( filesystem );
add( create ) ; add( create ) ;
add( grow ) ; add( grow ) ;
add( online_grow ) ;
add( shrink ) ; add( shrink ) ;
add( online_shrink ) ;
add( move ) ; add( move ) ;
add( copy ) ; add( copy ) ;
add( check ) ; add( check ) ;
@ -76,7 +80,7 @@ private:
treeview_filesystems_Columns treeview_filesystems_columns ; treeview_filesystems_Columns treeview_filesystems_columns ;
Glib::RefPtr<Gdk::Pixbuf> icon_yes, icon_no ; Glib::RefPtr<Gdk::Pixbuf> icon_yes, icon_no, icon_blank ;
}; };
} //GParted } //GParted

View File

@ -138,6 +138,8 @@ struct FS
Support copy ; Support copy ;
Support remove ; Support remove ;
Support online_read ; //Can and how to read sector usage while active Support online_read ; //Can and how to read sector usage while active
Support online_grow ;
Support online_shrink ;
Byte_Value MIN ; Byte_Value MIN ;
Byte_Value MAX ; Byte_Value MAX ;
@ -145,7 +147,8 @@ struct FS
FS() FS()
{ {
read = read_label = write_label = read_uuid = write_uuid = create = create_with_label = read = read_label = write_label = read_uuid = write_uuid = create = create_with_label =
grow = shrink = move = check = copy = remove = online_read = NONE ; grow = shrink = move = check = copy = remove = online_read =
online_grow = online_shrink = NONE ;
MIN = MAX = 0 ; MIN = MAX = 0 ;
} }
} ; } ;

View File

@ -29,13 +29,27 @@ DialogFeatures::DialogFeatures()
set_has_separator( false ) ; set_has_separator( false ) ;
set_resizable( false ) ; set_resizable( false ) ;
//initialize icons
icon_yes = render_icon( Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR );
icon_no = render_icon( Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR );
icon_blank = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, true, 8,
icon_yes ->get_width(), icon_yes ->get_height() );
icon_blank ->fill( 0xFFFFFF00 );
//treeview //treeview
Gtk::TreeView::Column *col;
liststore_filesystems = Gtk::ListStore::create( treeview_filesystems_columns ); liststore_filesystems = Gtk::ListStore::create( treeview_filesystems_columns );
treeview_filesystems .set_model( liststore_filesystems ); treeview_filesystems .set_model( liststore_filesystems );
treeview_filesystems .append_column( _("File System"), treeview_filesystems_columns .filesystem ); treeview_filesystems .append_column( _("File System"), treeview_filesystems_columns .filesystem );
treeview_filesystems .append_column( _("Create"), treeview_filesystems_columns .create ); treeview_filesystems .append_column( _("Create"), treeview_filesystems_columns .create );
treeview_filesystems .append_column( _("Grow"), treeview_filesystems_columns .grow ); col = manage( new Gtk::TreeView::Column( _("Grow") ) );
treeview_filesystems .append_column( _("Shrink"), treeview_filesystems_columns .shrink ); col ->pack_start( treeview_filesystems_columns .grow, false );
col ->pack_start( treeview_filesystems_columns .online_grow, false );
treeview_filesystems .append_column( *col );
col = manage( new Gtk::TreeView::Column( _("Shrink") ) );
col ->pack_start( treeview_filesystems_columns .shrink, false );
col ->pack_start( treeview_filesystems_columns .online_shrink, false );
treeview_filesystems .append_column( *col );
treeview_filesystems .append_column( _("Move"), treeview_filesystems_columns .move ); treeview_filesystems .append_column( _("Move"), treeview_filesystems_columns .move );
treeview_filesystems .append_column( _("Copy"), treeview_filesystems_columns .copy ); treeview_filesystems .append_column( _("Copy"), treeview_filesystems_columns .copy );
treeview_filesystems .append_column( _("Check"), treeview_filesystems_columns .check ); treeview_filesystems .append_column( _("Check"), treeview_filesystems_columns .check );
@ -72,18 +86,36 @@ DialogFeatures::DialogFeatures()
hbox = manage(new Gtk::HBox()); hbox = manage(new Gtk::HBox());
{ {
Gtk::Image* image(manage(new Gtk::Image(Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR))); Gtk::Image *image_yes( manage( new Gtk::Image( icon_yes ) ) );
hbox->pack_start(*image, Gtk::PACK_SHRINK); hbox ->pack_start( *image_yes, Gtk::PACK_SHRINK );
image_yes = manage( new Gtk::Image( icon_yes ) );
hbox ->pack_start( *image_yes, Gtk::PACK_SHRINK );
hbox->pack_start(*Utils::mk_label( hbox->pack_start(*Utils::mk_label(
/* TO TRANSLATORS: Available /* TO TRANSLATORS: Available offline and online
* means that this action is valid for this file system. * means that this action is valid for this file system when
* it is both unmounted and mounted.
*/ */
_("Available")), Gtk::PACK_EXPAND_WIDGET ); _("Available offline and online")), Gtk::PACK_EXPAND_WIDGET );
vbox ->pack_start(*hbox); vbox ->pack_start(*hbox);
hbox = manage(new Gtk::HBox() );
image_yes = manage( new Gtk::Image( icon_yes ) );
hbox ->pack_start( *image_yes, Gtk::PACK_SHRINK );
Gtk::Image *image_blank( manage( new Gtk::Image( icon_blank ) ) );
hbox ->pack_start( *image_blank, Gtk::PACK_SHRINK );
hbox ->pack_start( *Utils::mk_label(
/* TO TRANSLATORS: Available offline only
* means that this action is valid for this file system only
* when it is unmounted.
*/
_("Available offline only")), Gtk::PACK_EXPAND_WIDGET );
vbox ->pack_start( *hbox );
hbox = manage(new Gtk::HBox()); hbox = manage(new Gtk::HBox());
image = manage(new Gtk::Image(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR)); Gtk::Image *image_no( manage( new Gtk::Image( icon_no ) ) );
hbox->pack_start(*image, Gtk::PACK_SHRINK); hbox ->pack_start( *image_no, Gtk::PACK_SHRINK );
image_blank = manage( new Gtk::Image( icon_blank ) );
hbox ->pack_start( *image_blank, Gtk::PACK_SHRINK );
} }
hbox->pack_start(*Utils::mk_label( hbox->pack_start(*Utils::mk_label(
@ -106,10 +138,6 @@ DialogFeatures::DialogFeatures()
expander_legend.add(*hbox2); expander_legend.add(*hbox2);
} }
//initialize icons
icon_yes = render_icon( Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
icon_no = render_icon( Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
/*TO TRANSLATORS: This is a button that will search for the software tools installed and then refresh the screen with the file system actions supported. */ /*TO TRANSLATORS: This is a button that will search for the software tools installed and then refresh the screen with the file system actions supported. */
add_button( _("Rescan For Supported Actions"), Gtk::RESPONSE_OK ); add_button( _("Rescan For Supported Actions"), Gtk::RESPONSE_OK );
add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ) ->grab_focus() ; add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ) ->grab_focus() ;
@ -142,7 +170,9 @@ void DialogFeatures::show_filesystem( const FS & fs )
treerow[ treeview_filesystems_columns .create ] = fs .create ? icon_yes : icon_no ; treerow[ treeview_filesystems_columns .create ] = fs .create ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .grow ] = fs .grow ? icon_yes : icon_no ; treerow[ treeview_filesystems_columns .grow ] = fs .grow ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .online_grow ] = fs .online_grow ? icon_yes : icon_blank ;
treerow[ treeview_filesystems_columns .shrink ] = fs .shrink ? icon_yes : icon_no ; treerow[ treeview_filesystems_columns .shrink ] = fs .shrink ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .online_shrink ] = fs .online_shrink ? icon_yes : icon_blank ;
treerow[ treeview_filesystems_columns .move ] = fs .move ? icon_yes : icon_no ; treerow[ treeview_filesystems_columns .move ] = fs .move ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .copy ] = fs .copy ? icon_yes : icon_no ; treerow[ treeview_filesystems_columns .copy ] = fs .copy ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .check ] = fs .check ? icon_yes : icon_no ; treerow[ treeview_filesystems_columns .check ] = fs .check ? icon_yes : icon_no ;

View File

@ -78,7 +78,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
} }
//see if we need a fixed_start //see if we need a fixed_start
if ( fs .move ) if ( fs .move && ! selected_partition .busy )
{ {
set_title( String::ucompose( _("Resize/Move %1"), selected_partition .get_path() ) ) ; set_title( String::ucompose( _("Resize/Move %1"), selected_partition .get_path() ) ) ;
frame_resizer_base ->set_fixed_start( false ) ; frame_resizer_base ->set_fixed_start( false ) ;
@ -161,7 +161,9 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
frame_resizer_base ->set_used( Utils::round( min_resize / ( total_length / 500.00 ) ) ) ; frame_resizer_base ->set_used( Utils::round( min_resize / ( total_length / 500.00 ) ) ) ;
//set MIN //set MIN
if ( fs .shrink ) if ( ( fs .shrink && ! selected_partition .busy )
|| ( fs .online_shrink && selected_partition .busy )
)
{ {
//since some file systems have lower limits we need to check for this //since some file systems have lower limits we need to check for this
if ( min_resize > (fs .MIN / selected_partition .sector_size) ) if ( min_resize > (fs .MIN / selected_partition .sector_size) )

View File

@ -360,6 +360,9 @@ void Dialog_Progress::on_save()
<< "<p>" << _("GParted") << " " << VERSION << "<p>" << _("GParted") << " " << VERSION
#ifdef USE_LIBPARTED_DMRAID #ifdef USE_LIBPARTED_DMRAID
<< " --enable-libparted-dmraid" << " --enable-libparted-dmraid"
#endif
#ifdef ENABLE_ONLINE_RESIZE
<< " --enable-online-resize"
#endif #endif
<< "</p>" << std::endl << "</p>" << std::endl
<< "<p>" << _("Libparted") << " " << signal_get_libparted_version .emit() << "</p>" << std::endl ; << "<p>" << _("Libparted") << " " << signal_get_libparted_version .emit() << "</p>" << std::endl ;

View File

@ -2271,7 +2271,7 @@ bool GParted_Core::resize( const Partition & partition_old,
} }
bool succes = false ; bool succes = false ;
if ( check_repair_filesystem( partition_new, operationdetail ) ) if ( partition_new. busy || check_repair_filesystem( partition_new, operationdetail ) )
{ {
succes = true ; succes = true ;
@ -2288,7 +2288,7 @@ bool GParted_Core::resize( const Partition & partition_old,
|| partition_new .get_sector_length() > partition_old .get_sector_length() || partition_new .get_sector_length() > partition_old .get_sector_length()
) )
) )
succes = check_repair_filesystem( partition_new, operationdetail ) succes = ( partition_new. busy || check_repair_filesystem( partition_new, operationdetail ) )
&& maximize_filesystem( partition_new, operationdetail ) ; && maximize_filesystem( partition_new, operationdetail ) ;
return succes ; return succes ;

View File

@ -943,7 +943,10 @@ void Win_GParted::set_valid_operations()
//no partition selected... //no partition selected...
if ( ! selected_partition .get_paths() .size() ) if ( ! selected_partition .get_paths() .size() )
return ; return ;
//get filesystem capabilities
fs = gparted_core .get_fs( selected_partition .filesystem ) ;
//if there's something, there's some info ;) //if there's something, there's some info ;)
allow_info( true ) ; allow_info( true ) ;
@ -994,7 +997,16 @@ void Win_GParted::set_valid_operations()
) )
allow_toggle_busy_state( true ) ; allow_toggle_busy_state( true ) ;
//only unmount/swapoff/VG deactivate/... is allowed if busy #ifdef ENABLE_ONLINE_RESIZE
//Find out if online resizing is possible
if ( selected_partition .busy )
{
if ( ( fs .online_grow || fs .online_shrink ) && ! devices[ current_device ] .readonly )
allow_resize( true ) ;
}
#endif
//only unmount/swapoff/VG deactivate or online actions allowed if busy
if ( selected_partition .busy ) if ( selected_partition .busy )
return ; return ;
@ -1073,8 +1085,6 @@ void Win_GParted::set_valid_operations()
//PRIMARY and LOGICAL //PRIMARY and LOGICAL
if ( selected_partition .type == GParted::TYPE_PRIMARY || selected_partition .type == GParted::TYPE_LOGICAL ) if ( selected_partition .type == GParted::TYPE_PRIMARY || selected_partition .type == GParted::TYPE_LOGICAL )
{ {
fs = gparted_core .get_fs( selected_partition .filesystem ) ;
allow_delete( true ) ; allow_delete( true ) ;
allow_format( true ) ; allow_format( true ) ;

View File

@ -103,6 +103,13 @@ FS btrfs::get_filesystem_support()
} }
fs .online_read = FS::GPARTED ; fs .online_read = FS::GPARTED ;
#ifdef ENABLE_ONLINE_RESIZE
if ( Utils::kernel_version_at_least( 3, 6, 0 ) )
{
fs .online_grow = fs .grow ;
fs .online_shrink = fs .shrink ;
}
#endif
fs .MIN = 256 * MEBIBYTE ; fs .MIN = 256 * MEBIBYTE ;
@ -174,12 +181,17 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation
{ {
bool success = true ; bool success = true ;
Glib::ustring mount_point = mk_temp_dir( "", operationdetail ) ; Glib::ustring mount_point ;
if ( mount_point .empty() ) if ( ! partition_new .busy )
return false ; {
mount_point = mk_temp_dir( "", operationdetail ) ;
success &= ! execute_command( "mount -v -t btrfs " + partition_new .get_path() + " " + mount_point, if ( mount_point .empty() )
operationdetail, true ) ; return false ;
success &= ! execute_command( "mount -v -t btrfs " + partition_new .get_path() + " " + mount_point,
operationdetail, true ) ;
}
else
mount_point = partition_new .get_mountpoint() ;
if ( success ) if ( success )
{ {
@ -219,10 +231,12 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation
operationdetail .get_last_child() .set_status( resize_succeeded ? STATUS_SUCCES : STATUS_ERROR ) ; operationdetail .get_last_child() .set_status( resize_succeeded ? STATUS_SUCCES : STATUS_ERROR ) ;
success &= resize_succeeded ; success &= resize_succeeded ;
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ; if ( ! partition_new .busy )
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ;
} }
rm_temp_dir( mount_point, operationdetail ) ; if ( ! partition_new .busy )
rm_temp_dir( mount_point, operationdetail ) ;
return success ; return success ;
} }

View File

@ -66,6 +66,10 @@ FS ext2::get_filesystem_support()
} }
fs .online_read = FS::EXTERNAL ; fs .online_read = FS::EXTERNAL ;
#ifdef ENABLE_ONLINE_RESIZE
if ( specific_type != FS_EXT2 && Utils::kernel_version_at_least( 3, 6, 0 ) )
fs .online_grow = fs .grow ;
#endif
} }
return fs ; return fs ;

View File

@ -63,6 +63,10 @@ FS jfs::get_filesystem_support()
} }
fs .online_read = FS::GPARTED ; fs .online_read = FS::GPARTED ;
#ifdef ENABLE_ONLINE_RESIZE
if ( Utils::kernel_version_at_least( 3, 6, 0 ) )
fs .online_grow = fs .grow ;
#endif
fs .MIN = 16 * MEBIBYTE ; fs .MIN = 16 * MEBIBYTE ;
@ -161,22 +165,29 @@ bool jfs::resize( const Partition & partition_new, OperationDetail & operationde
{ {
bool success = true ; bool success = true ;
Glib::ustring mount_point = mk_temp_dir( "", operationdetail ) ; Glib::ustring mount_point ;
if ( mount_point .empty() ) if ( ! partition_new .busy )
return false ; {
mount_point = mk_temp_dir( "", operationdetail ) ;
success &= ! execute_command( "mount -v -t jfs " + partition_new .get_path() + " " + mount_point, if ( mount_point .empty() )
operationdetail, true ) ; return false ;
success &= ! execute_command( "mount -v -t jfs " + partition_new .get_path() + " " + mount_point,
operationdetail, true ) ;
}
else
mount_point = partition_new .get_mountpoint() ;
if ( success ) if ( success )
{ {
success &= ! execute_command( "mount -v -t jfs -o remount,resize " + partition_new .get_path() + " " + mount_point, success &= ! execute_command( "mount -v -t jfs -o remount,resize " + partition_new .get_path() + " " + mount_point,
operationdetail, true ) ; operationdetail, true ) ;
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ; if ( ! partition_new .busy )
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ;
} }
rm_temp_dir( mount_point, operationdetail ) ; if ( ! partition_new .busy )
rm_temp_dir( mount_point, operationdetail ) ;
return success ; return success ;
} }

View File

@ -61,6 +61,13 @@ FS lvm2_pv::get_filesystem_support()
fs .check = FS::EXTERNAL ; fs .check = FS::EXTERNAL ;
fs .remove = FS::EXTERNAL ; fs .remove = FS::EXTERNAL ;
fs .online_read = FS::EXTERNAL ; fs .online_read = FS::EXTERNAL ;
#ifdef ENABLE_ONLINE_RESIZE
if ( Utils::kernel_version_at_least( 3, 6, 0 ) )
{
fs .online_grow = fs .grow ;
fs .online_shrink = fs.shrink ;
}
#endif
} }
return fs ; return fs ;

View File

@ -57,6 +57,13 @@ FS nilfs2::get_filesystem_support()
fs .copy = GParted::FS::GPARTED ; fs .copy = GParted::FS::GPARTED ;
fs .move = GParted::FS::GPARTED ; fs .move = GParted::FS::GPARTED ;
fs .online_read = FS::GPARTED ; fs .online_read = FS::GPARTED ;
#ifdef ENABLE_ONLINE_RESIZE
if ( Utils::kernel_version_at_least( 3, 6, 0 ) )
{
fs .online_grow = fs .grow ;
fs .online_shrink = fs .shrink ;
}
#endif
//Minimum FS size is 128M+4K using mkfs.nilfs2 defaults //Minimum FS size is 128M+4K using mkfs.nilfs2 defaults
fs .MIN = 128 * MEBIBYTE + 4 * KIBIBYTE ; fs .MIN = 128 * MEBIBYTE + 4 * KIBIBYTE ;
@ -160,12 +167,16 @@ bool nilfs2::resize( const Partition & partition_new, OperationDetail & operatio
{ {
bool success = true ; bool success = true ;
Glib::ustring mount_point = mk_temp_dir( "", operationdetail ) ; Glib::ustring mount_point ;
if ( mount_point .empty() ) if ( ! partition_new .busy )
return false ; {
mount_point = mk_temp_dir( "", operationdetail ) ;
if ( mount_point .empty() )
return false ;
success &= ! execute_command( "mount -v -t nilfs2 " + partition_new .get_path() + " " + mount_point, success &= ! execute_command( "mount -v -t nilfs2 " + partition_new .get_path() + " " + mount_point,
operationdetail, true ) ; operationdetail, true ) ;
}
if ( success ) if ( success )
{ {
@ -178,10 +189,12 @@ bool nilfs2::resize( const Partition & partition_new, OperationDetail & operatio
} }
success &= ! execute_command( cmd, operationdetail, true ) ; success &= ! execute_command( cmd, operationdetail, true ) ;
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ; if ( ! partition_new. busy )
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ;
} }
rm_temp_dir( mount_point, operationdetail ) ; if ( ! partition_new .busy )
rm_temp_dir( mount_point, operationdetail ) ;
return success ; return success ;
} }

View File

@ -65,6 +65,10 @@ FS reiserfs::get_filesystem_support()
} }
fs .online_read = FS::GPARTED ; fs .online_read = FS::GPARTED ;
#ifdef ENABLE_ONLINE_RESIZE
if ( Utils::kernel_version_at_least( 3, 6, 0 ) )
fs. online_grow = fs. grow ;
#endif
//Actual minimum is at least 18 blocks larger than 32 MiB for the journal offset //Actual minimum is at least 18 blocks larger than 32 MiB for the journal offset
fs .MIN = 34 * MEBIBYTE ; fs .MIN = 34 * MEBIBYTE ;

View File

@ -70,6 +70,10 @@ FS xfs::get_filesystem_support()
fs .move = GParted::FS::GPARTED ; fs .move = GParted::FS::GPARTED ;
fs .online_read = FS::GPARTED ; fs .online_read = FS::GPARTED ;
#ifdef ENABLE_ONLINE_RESIZE
if ( Utils::kernel_version_at_least( 3, 6, 0 ) )
fs .online_grow = fs .grow ;
#endif
fs .MIN = 32 * MEBIBYTE ;//official minsize = 16MB, but the smallest xfs_repair can handle is 32MB... fs .MIN = 32 * MEBIBYTE ;//official minsize = 16MB, but the smallest xfs_repair can handle is 32MB...
@ -178,21 +182,28 @@ bool xfs::resize( const Partition & partition_new, OperationDetail & operationde
{ {
bool success = true ; bool success = true ;
Glib::ustring mount_point = mk_temp_dir( "", operationdetail ) ; Glib::ustring mount_point ;
if ( mount_point .empty() ) if ( ! partition_new .busy )
return false ; {
mount_point = mk_temp_dir( "", operationdetail ) ;
success &= ! execute_command( "mount -v -t xfs " + partition_new .get_path() + " " + mount_point, if ( mount_point.empty() )
operationdetail, true ) ; return false ;
success &= ! execute_command( "mount -v -t xfs " + partition_new .get_path() + " " + mount_point,
operationdetail, true ) ;
}
else
mount_point = partition_new .get_mountpoint() ;
if ( success ) if ( success )
{ {
success &= ! execute_command( "xfs_growfs " + mount_point, operationdetail, true ) ; success &= ! execute_command( "xfs_growfs " + mount_point, operationdetail, true ) ;
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ; if ( ! partition_new .busy )
success &= ! execute_command( "umount -v " + mount_point, operationdetail, true ) ;
} }
rm_temp_dir( mount_point, operationdetail ) ; if ( ! partition_new .busy )
rm_temp_dir( mount_point, operationdetail ) ;
return success ; return success ;
} }