package fs::format; # $Id: format.pm 268842 2010-05-17 06:54:44Z pterjan $ use diagnostics; use strict; use String::ShellQuote; use run_program; use common; use fs::type; use fs::loopback; use log; my %cmds = ( ext2 => [ 'e2fsprogs', 'mkfs.ext2', '-F' ], ext3 => [ 'e2fsprogs', 'mkfs.ext3', '-F' ], ext4 => [ 'e2fsprogs', 'mkfs.ext4', '-F' ], reiserfs => [ 'reiserfsprogs', 'mkfs.reiserfs', '-ff' ], reiser4 => [ 'reiser4progs', 'mkfs.reiser4', '-f', '-y' ], xfs => [ 'xfsprogs', 'mkfs.xfs', '-f', '-q' ], jfs => [ 'jfsutils', 'mkfs.jfs', '-f' ], hfs => [ 'hfsutils', 'hformat' ], dos => [ 'dosfstools', 'mkdosfs' ], vfat => [ 'dosfstools', 'mkdosfs', '-F', '32' ], swap => [ 'util-linux-ng', 'mkswap' ], ntfs => [ 'ntfsprogs', 'mkntfs', '--fast' ], 'ntfs-3g' => [ 'ntfsprogs', 'mkntfs', '--fast' ], btrfs => [ 'btrfs-progs', 'mkfs.btrfs' ], nilfs2 => [ 'nilfs-utils', 'mkfs.nilfs2' ], ); my %LABELs = ( #- option, length, handled_by_mount ext2 => [ '-L', 16, 1 ], ext3 => [ '-L', 16, 1 ], ext4 => [ '-L', 16, 1 ], reiserfs => [ '-l', 16, 1 ], reiser4 => [ '-L', 16, 1 ], xfs => [ '-L', 12, 1 ], jfs => [ '-L', 16, 1 ], hfs => [ '-l', 27, 0 ], dos => [ '-n', 11, 0 ], vfat => [ '-n', 11, 0 ], swap => [ '-L', 15, 1 ], ntfs => [ '-L', 128, 0 ], 'ntfs-3g' => [ '-L', 128, 0 ], btrfs => [ '-L', 256, 1 ], nilfs2 => [ '-L', 16, 1], ); my %edit_LABEL = ( # package, command, option # If option is defined, run