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 ( ); }
[ [ "", $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);
$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'}) {
# 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);
# 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'}";
# 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"));
}
# 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") {
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"));
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" : ""));
}
}
+# 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