mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Support for creating ext4 filesystems
This commit is contained in:
@@ -23,3 +23,5 @@ Changed the module's main page so that it only lists disks, with links to a sepa
|
||||
Re-wrote all code to use the new Webmin user interface library, for a more consistent look.
|
||||
---- Changes since 1.490 ----
|
||||
Added support for new SCSI device information files under /sys, as seen in 2.6.30+ kernels.
|
||||
---- Changes since 1.500 ----
|
||||
Added support for creating EXT4 filesystems.
|
||||
|
||||
@@ -572,7 +572,7 @@ local @rv;
|
||||
if ($_[0] eq "4" || $_[0] eq "6" ||
|
||||
$_[0] eq "1" || $_[0] eq "e") { @rv = ( "msdos" ); }
|
||||
elsif ($_[0] eq "b" || $_[0] eq "c") { @rv = ( "vfat" ); }
|
||||
elsif ($_[0] eq "83") { @rv = ( "ext3", "ext2" ); }
|
||||
elsif ($_[0] eq "83") { @rv = ( "ext3", "ext4", "ext2" ); }
|
||||
elsif ($_[0] eq "82") { @rv = ( "swap" ); }
|
||||
elsif ($_[0] eq "81") { @rv = ( "minix" ); }
|
||||
else { return ( ); }
|
||||
@@ -630,7 +630,7 @@ elsif ($_[0] eq "reiserfs") {
|
||||
[ [ "", $text{'default'} ],
|
||||
[ "rupasov", "tea" ] ]));
|
||||
}
|
||||
elsif ($_[0] eq "ext3") {
|
||||
elsif ($_[0] =~ /^ext\d+$/) {
|
||||
&opt_input("ext2_b", $text{'bytes'}, 1);
|
||||
&opt_input("ext2_f", $text{'bytes'}, 0);
|
||||
&opt_input("ext2_i", "", 1);
|
||||
@@ -705,15 +705,19 @@ elsif ($_[0] eq "reiserfs") {
|
||||
$cmd .= " -h $in{'reiserfs_h'}" if ($in{'reiserfs_h'});
|
||||
$cmd .= " $_[1]";
|
||||
}
|
||||
elsif ($_[0] eq "ext3") {
|
||||
if (&has_command("mkfs.ext3")) {
|
||||
$cmd = "mkfs -t ext3";
|
||||
elsif ($_[0] =~ /^ext\d+$/) {
|
||||
if (&has_command("mkfs.$_[0]")) {
|
||||
$cmd = "mkfs -t $_[0]";
|
||||
$cmd .= &opt_check("ext3_j", '\d+', "-j");
|
||||
}
|
||||
elsif (&has_command("mke3fs")) {
|
||||
elsif ($_[0] eq "ext3" && &has_command("mke3fs")) {
|
||||
$cmd = "mke3fs";
|
||||
$cmd .= &opt_check("ext3_j", '\d+', "-j");
|
||||
}
|
||||
elsif ($_[0] eq "ext4" && &has_command("mke4fs")) {
|
||||
$cmd = "mke4fs";
|
||||
$cmd .= &opt_check("ext3_j", '\d+', "-j");
|
||||
}
|
||||
else {
|
||||
$cmd = "mkfs.ext2 -j";
|
||||
if (!$in{'ext3_j_def'}) {
|
||||
@@ -755,14 +759,14 @@ return $cmd;
|
||||
# Returns 1 if this filesystem type can be tuned
|
||||
sub can_tune
|
||||
{
|
||||
return $_[0] eq "ext2" || $_[0] eq "ext3";
|
||||
return $_[0] =~ /^ext\d+$/;
|
||||
}
|
||||
|
||||
# tunefs_options(type)
|
||||
# Output HTML for tuning options for some filesystem type
|
||||
sub tunefs_options
|
||||
{
|
||||
if ($_[0] eq "ext2" || $_[0] eq "ext3") {
|
||||
if ($_[0] =~ /^ext\d+$/) {
|
||||
# Gaps between checks
|
||||
&opt_input("tunefs_c", "", 1);
|
||||
|
||||
@@ -801,7 +805,7 @@ if ($_[0] eq "ext2" || $_[0] eq "ext3") {
|
||||
# Returns the tuning command based on user inputs
|
||||
sub tunefs_parse
|
||||
{
|
||||
if ($_[0] eq "ext2" || $_[0] eq "ext3") {
|
||||
if ($_[0] =~ /^ext\d+$/) {
|
||||
$cmd = "tune2fs";
|
||||
$cmd .= &opt_check("tunefs_c", '\d+', "-c");
|
||||
$cmd .= $in{'tunefs_e_def'} ? "" : " -e$in{'tunefs_e'}";
|
||||
@@ -872,8 +876,7 @@ return ();
|
||||
# Returns 1 if some filesystem type can fsck'd
|
||||
sub can_fsck
|
||||
{
|
||||
return ($_[0] eq "ext2" && &has_command("fsck.ext2") ||
|
||||
$_[0] eq "ext3" && &has_command("fsck.ext3") ||
|
||||
return ($_[0] =~ /^ext\d+$/ && &has_command("fsck.$_[0]") ||
|
||||
$_[0] eq "minix" && &has_command("fsck.minix"));
|
||||
}
|
||||
|
||||
@@ -881,7 +884,7 @@ return ($_[0] eq "ext2" && &has_command("fsck.ext2") ||
|
||||
# Returns the fsck command to unconditionally check a filesystem
|
||||
sub fsck_command
|
||||
{
|
||||
if ($_[0] eq "ext2" || $_[0] eq "ext3") {
|
||||
if ($_[0] =~ /^ext\d+$/) {
|
||||
return "fsck -t $_[0] -p $_[1]";
|
||||
}
|
||||
elsif ($_[0] eq "minix") {
|
||||
@@ -1172,6 +1175,8 @@ local @fstypes = ( "ext2" );
|
||||
push(@fstypes, "ext3") if (&has_command("mkfs.ext3") ||
|
||||
&has_command("mke3fs") ||
|
||||
`mkfs.ext2 -h 2>&1` =~ /\[-j\]/);
|
||||
push(@fstypes, "ext4") if (&has_command("mkfs.ext4") ||
|
||||
&has_command("mke4fs"));
|
||||
push(@fstypes, "reiserfs") if (&has_command("mkreiserfs"));
|
||||
push(@fstypes, "xfs") if (&has_command("mkfs.xfs"));
|
||||
push(@fstypes, "jfs") if (&has_command("mkfs.jfs"));
|
||||
|
||||
@@ -20,3 +20,5 @@ When creating a logical volume, size can now be specified as a fraction of the v
|
||||
---- Changes since 1.480 ----
|
||||
Added an option to force addition of a physical volume to a group.
|
||||
Cleaned up code to use quotemeta instead of manual quoting.
|
||||
---- Changes since 1.500 ----
|
||||
Added support for creating EXT4 filesystems.
|
||||
|
||||
@@ -436,7 +436,7 @@ return $? ? $out : undef;
|
||||
# 0 = no, 1 = enlarge only, 2 = enlarge or shrink
|
||||
sub can_resize_filesystem
|
||||
{
|
||||
if ($_[0] eq "ext2" || $_[0] eq "ext3") {
|
||||
if ($_[0] =~ /^ext\d+$/) {
|
||||
if (&has_command("e2fsadm")) {
|
||||
return 2; # Can extend and reduce
|
||||
}
|
||||
|
||||
@@ -28,3 +28,5 @@ Added an option to skip initialization of metadata when creating a RAID device.
|
||||
RAID 6 devices can now have spares, thanks to Caspar Smit.
|
||||
---- Changes since 1.490 ----
|
||||
Added a button to remove a detached partition, thanks to Caspar Smit.
|
||||
---- Changes since 1.500 ----
|
||||
Added support for creating EXT4 filesystems.
|
||||
|
||||
@@ -13,7 +13,7 @@ $cmd = &fdisk::mkfs_parse($in{'fs'}, $raid->{'value'});
|
||||
|
||||
$lvl = &find_value('raid-level', $raid->{'members'});
|
||||
$chunk = &find_value('chunk-size', $raid->{'members'});
|
||||
if ($lvl >= 4 && ($in{'fs'} eq 'ext2' || $in{'fs'} eq 'ext3')) {
|
||||
if ($lvl >= 4 && $in{'fs'} =~ /^ext\d+$/ {
|
||||
$bs = $in{'ext2_b_def'} ? 4096 : $in{'ext2_b'};
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,8 @@ else {
|
||||
local $lref = &read_file_lines($config{'mdadm'});
|
||||
local $lvl = &find_value('raid-level', $_[0]->{'members'});
|
||||
$lvl = $lvl =~ /^\d+$/ ? "raid$lvl" : $lvl;
|
||||
push(@$lref, "DEVICE ".join(" ", @devices));
|
||||
push(@$lref, "DEVICE ".
|
||||
join(" ", map { &device_to_volid($_) } @devices));
|
||||
push(@$lref, "ARRAY $_[0]->{'value'} level=$lvl devices=".
|
||||
join(",", @devices).
|
||||
($sg ? " spare-group=$sg" : ""));
|
||||
@@ -301,6 +302,16 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
# device_to_volid(device)
|
||||
# Given a device name like /dev/sda1, convert it to a volume ID if possible.
|
||||
# Otherwise return the device name.
|
||||
sub device_to_volid
|
||||
{
|
||||
local ($dev) = @_;
|
||||
return $dev;
|
||||
#return &fdisk::get_volid($dev) || $dev;
|
||||
}
|
||||
|
||||
# make_raid(&raid, force, [missing], [assume-clean])
|
||||
# Call mkraid or mdadm to make a raid set for real
|
||||
sub make_raid
|
||||
|
||||
Reference in New Issue
Block a user