Second, try mounting file systems specifying the type (#742741)
On RHEL/CentOS 6, GParted fails to mount nilfs2 file system like this: # mkfs.nilfs2 /dev/sdb1 # mount /dev/sdb1 /mnt/1 mount: you must specify the filesystem type This fails because mount internally uses libblkid to determine the file system type when it is not specified on the command line. However on RHEL/CentOS 6 libblkid is too old to recognise nilfs2. GParted used libparted recognition first and blkid second. Mount only uses libblkid. When there are multiple signatures on a partition GParted may report a different result to blkid alone. Therefore fix by first trying to mount the file system without specifying the type, as is already done, and if that fails, trying specifying the file system type. This allows GParted to mount nilfs2 file systems. # mount -t nilfs2 /dev/sdb1 /mnt/1 # mount | fgrep sdb1 /dev/sdb1 on /mnt/1 type nilfs2 (rw,gcpid=30946) And for unsupported file systems the error dialog from the failed mount command shows both commands like this: (-) Could not mount /dev/sdb3 on /mnt/3 # mount -v /dev/sdb3 "/mnt/3" mount: unknown filesystem type 'reiser4' # mount -v -t reiser4 /dev/sdb3 "/mnt/3" mount: unknown filesystem type 'reiser4' [ OK ] Bug 742741 - Nilfs2 file system is unusable on RHEL/CentOS 6
This commit is contained in:
parent
0bdc1fef14
commit
8d9c6f197d
|
@ -2284,15 +2284,34 @@ void Win_GParted::activate_mount_partition( unsigned int index )
|
|||
Glib::ustring cmd;
|
||||
Glib::ustring output;
|
||||
Glib::ustring error;
|
||||
Glib::ustring message;
|
||||
|
||||
show_pulsebar( String::ucompose( _("mounting %1 on %2"),
|
||||
selected_partition .get_path(),
|
||||
selected_partition .get_mountpoints()[ index ] ) ) ;
|
||||
|
||||
// First try mounting letting mount (libblkid) determine the file system type.
|
||||
// Do this because GParted uses libparted first and blkid second and when there
|
||||
// are multiple signatures GParted may report a different result to blkid alone.
|
||||
cmd = "mount -v " + selected_partition.get_path() +
|
||||
" \"" + selected_partition.get_mountpoints()[index] + "\"";
|
||||
// FIXME: Replace debugging with mount specifying file system type
|
||||
std::cout << "DEBUG: (" << Utils::get_filesystem_kernel_name( selected_partition.filesystem ) << ") # " << cmd << std::endl;
|
||||
success = ! Utils::execute_command( cmd, output, error );
|
||||
if ( ! success )
|
||||
{
|
||||
message = "# " + cmd + "\n" + error;
|
||||
|
||||
Glib::ustring type = Utils::get_filesystem_kernel_name( selected_partition.filesystem );
|
||||
if ( ! type.empty() )
|
||||
{
|
||||
// Second try mounting specifying the GParted determined file
|
||||
// system type.
|
||||
cmd = "mount -v -t " + type + " " + selected_partition.get_path() +
|
||||
" \"" + selected_partition.get_mountpoints()[index] + "\"";
|
||||
success = ! Utils::execute_command( cmd, output, error );
|
||||
if ( ! success )
|
||||
message += "\n# " + cmd + "\n" + error;
|
||||
}
|
||||
}
|
||||
hide_pulsebar();
|
||||
if ( ! success )
|
||||
{
|
||||
|
@ -2305,7 +2324,7 @@ void Win_GParted::activate_mount_partition( unsigned int index )
|
|||
Gtk::BUTTONS_OK,
|
||||
true );
|
||||
|
||||
dialog.set_secondary_text( "# " + cmd + "\n" + error );
|
||||
dialog.set_secondary_text( message );
|
||||
|
||||
dialog.run() ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue