initial commit of partman-btrfs
This is untested and unlikely to work without parted support. Committing what I have since I don't trust btrfs to preserve the data. ;-) Note to translators: Probably not worth wasting your time with this yet. Have not run debconf-updatepo. r62090
This commit is contained in:
commit
0eb02adc27
28 changed files with 539 additions and 0 deletions
10
TODO
Normal file
10
TODO
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
* Support for multi-volume btrfs filesystems
|
||||||
|
* Support for other mkfs.btrfs options, if any are useful.
|
||||||
|
* Support for btrfs snapshots / using existing btrfs?
|
||||||
|
* Check if errors=remount-ro makes sense to use.
|
||||||
|
* mountoptions is missing a few options that may be worth supporting,
|
||||||
|
including degraded, and all optionds that require a parameter.
|
||||||
|
* mountoptions contains nobarrier, which is an unsafe option. Remove? Warn?
|
||||||
|
* parted support needed for filesystem detection #567176
|
||||||
|
* Resizing?
|
||||||
|
* Allow forcing use of btrfs for /boot (would probably work with eg, lilo)
|
||||||
1
active_partition/_numbers
Normal file
1
active_partition/_numbers
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
45 btrfs
|
||||||
70
active_partition/btrfs/choices
Executable file
70
active_partition/btrfs/choices
Executable file
|
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
dev=$1
|
||||||
|
id=$2
|
||||||
|
part=$dev/$id
|
||||||
|
|
||||||
|
cd $dev
|
||||||
|
|
||||||
|
[ -f $part/method -a -f $part/acting_filesystem ] || exit 0
|
||||||
|
|
||||||
|
filesystem=$(cat $part/acting_filesystem)
|
||||||
|
|
||||||
|
case "$filesystem" in
|
||||||
|
btrfs)
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
choice_mountpoint () {
|
||||||
|
case "$filesystem" in
|
||||||
|
btrfs)
|
||||||
|
if [ -f $part/mountpoint ]; then
|
||||||
|
mp=$(cat $part/mountpoint)
|
||||||
|
else
|
||||||
|
db_metaget partman-basicfilesystems/text/no_mountpoint description
|
||||||
|
mp="$RET"
|
||||||
|
fi
|
||||||
|
db_metaget partman-btrfs/text/specify_mountpoint description
|
||||||
|
printf "mountpoint\t%s\${!TAB}%s\n" "$RET" "$mp"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
choice_options () {
|
||||||
|
db_metaget partman-basicfilesystems/text/options description
|
||||||
|
printf "options\t%s\${!TAB}%.45s\n" "$RET" "$(get_mountoptions $dev $id)"
|
||||||
|
}
|
||||||
|
|
||||||
|
choice_label () {
|
||||||
|
# allow to set label only if the partition is to be formatted
|
||||||
|
[ -f $part/format ] || return 0
|
||||||
|
[ ! -f $part/formatted \
|
||||||
|
-o $part/formatted -ot $part/method \
|
||||||
|
-o $part/formatted -ot $part/filesystem ] || return 0
|
||||||
|
case "$filesystem" in
|
||||||
|
btrfs)
|
||||||
|
if [ -f $part/label ]; then
|
||||||
|
label=$(cat $part/label)
|
||||||
|
else
|
||||||
|
db_metaget partman-basicfilesystems/text/none description
|
||||||
|
label=$RET
|
||||||
|
fi
|
||||||
|
db_metaget partman-basicfilesystems/text/specify_label description
|
||||||
|
printf "label\t%s\${!TAB}%s\n" "$RET" "$label"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
choice_mountpoint
|
||||||
|
|
||||||
|
choice_options
|
||||||
|
|
||||||
|
choice_label
|
||||||
41
active_partition/btrfs/do_option
Executable file
41
active_partition/btrfs/do_option
Executable file
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
|
dev=$2
|
||||||
|
id=$3
|
||||||
|
part=$dev/$id
|
||||||
|
|
||||||
|
cd $dev
|
||||||
|
|
||||||
|
[ -f $part/method -a -f $part/acting_filesystem ] || return 0
|
||||||
|
filesystem=$(cat $part/acting_filesystem)
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
mountpoint)
|
||||||
|
if select_mountpoint $dev $id; then
|
||||||
|
update_partition $dev $id
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
options)
|
||||||
|
select_mountoptions $dev $id
|
||||||
|
;;
|
||||||
|
label)
|
||||||
|
label=''
|
||||||
|
if [ -f $part/label ]; then
|
||||||
|
label=$(cat $part/label)
|
||||||
|
fi
|
||||||
|
db_set partman-basicfilesystems/choose_label "$label"
|
||||||
|
db_input critical partman-basicfilesystems/choose_label || true
|
||||||
|
db_go || exit 1
|
||||||
|
db_get partman-basicfilesystems/choose_label
|
||||||
|
if [ "$RET" ]; then
|
||||||
|
echo "$RET" >$part/label
|
||||||
|
else
|
||||||
|
rm -f $part/label
|
||||||
|
fi
|
||||||
|
db_reset partman-basicfilesystems/choose_label
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
2
check.d/_numbers
Normal file
2
check.d/_numbers
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
09 nomountpoint_btrfs
|
||||||
|
05 no_btrfs_boot
|
||||||
32
check.d/no_btrfs_boot
Executable file
32
check.d/no_btrfs_boot
Executable file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# grub and other bootloaders that read the filesystem do not support /boot
|
||||||
|
# on btrfs. (lilo should work). Detect and warn.
|
||||||
|
|
||||||
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
|
get_btrfs_root_boot () {
|
||||||
|
(for i in /lib/partman/fstab.d/*; do
|
||||||
|
[ -x "$i" ] || continue
|
||||||
|
$i
|
||||||
|
done) |
|
||||||
|
while read fs mp type options dump pass; do
|
||||||
|
if [ "$mp" = / ]; then
|
||||||
|
echo root_type=$type
|
||||||
|
elif [ "$mp" = /boot ]; then
|
||||||
|
echo boot_type=$type
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
eval "$(get_btrfs_root_boot)"
|
||||||
|
|
||||||
|
if [ "$boot_type" = btrfs ]; then
|
||||||
|
db_input critical partman-btrfs/btrfs_boot || true
|
||||||
|
db_go || exit 1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$boot_type" = "" ] && [ "$root_type" = btrfs ]; then
|
||||||
|
db_input critical partman-btrfs/btrfs_root || true
|
||||||
|
db_go || exit 1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
37
check.d/nomountpoint_btrfs
Executable file
37
check.d/nomountpoint_btrfs
Executable file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
|
for dev in $DEVICES/*; do
|
||||||
|
[ -d "$dev" ] || continue
|
||||||
|
cd $dev
|
||||||
|
partitions=
|
||||||
|
open_dialog PARTITIONS
|
||||||
|
while { read_line num id size type fs path name; [ "$id" ]; }; do
|
||||||
|
[ "$fs" != free ] || continue
|
||||||
|
partitions="$partitions $id,$num"
|
||||||
|
done
|
||||||
|
close_dialog
|
||||||
|
|
||||||
|
for part in $partitions; do
|
||||||
|
id=${part%,*}
|
||||||
|
num=${part#*,}
|
||||||
|
[ -f $id/method ] || continue
|
||||||
|
[ -f $id/acting_filesystem ] || continue
|
||||||
|
filesystem=$(cat $id/acting_filesystem)
|
||||||
|
case "$filesystem" in
|
||||||
|
btrfs)
|
||||||
|
[ ! -f "$id/mountpoint" ] || continue
|
||||||
|
db_subst partman-btrfs/no_mount_point PARTITION "$num"
|
||||||
|
db_subst partman-btrfs/no_mount_point FILESYSTEM "$filesystem"
|
||||||
|
db_subst partman-btrfs/no_mount_point DEVICE $(humandev $(cat device))
|
||||||
|
db_input critical partman-btrfs/no_mount_point || true
|
||||||
|
db_go || exit 1
|
||||||
|
db_get partman-btrfs/no_mount_point
|
||||||
|
if [ "$RET" = true ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
done
|
||||||
1
commit.d/_numbers
Normal file
1
commit.d/_numbers
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
50 format_btrfs
|
||||||
81
commit.d/format_btrfs
Executable file
81
commit.d/format_btrfs
Executable file
|
|
@ -0,0 +1,81 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
|
enable_swap
|
||||||
|
|
||||||
|
for dev in $DEVICES/*; do
|
||||||
|
[ -d "$dev" ] || continue
|
||||||
|
cd $dev
|
||||||
|
partitions=
|
||||||
|
open_dialog PARTITIONS
|
||||||
|
while { read_line num id size type fs path name; [ "$id" ]; }; do
|
||||||
|
[ "$fs" != free ] || continue
|
||||||
|
partitions="$partitions $id,$num"
|
||||||
|
done
|
||||||
|
close_dialog
|
||||||
|
|
||||||
|
for part in $partitions; do
|
||||||
|
id=${part%,*}
|
||||||
|
num=${part#*,}
|
||||||
|
[ -f $id/method -a -f $id/format \
|
||||||
|
-a -f $id/acting_filesystem ] || continue
|
||||||
|
filesystem=$(cat $id/acting_filesystem)
|
||||||
|
case $filesystem in
|
||||||
|
btrfs)
|
||||||
|
if [ -f $id/formatted ] && \
|
||||||
|
[ $id/formatted -nt $id/method ] && \
|
||||||
|
([ ! -f $id/filesystem ] || \
|
||||||
|
[ $id/formatted -nt $id/filesystem ]); then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
log "Try to create file system for $dev/$id"
|
||||||
|
if [ -f $id/mountpoint ]; then
|
||||||
|
template=partman-basicfilesystems/progress_formatting_mountable
|
||||||
|
db_subst $template MOUNT_POINT "$(cat $id/mountpoint)"
|
||||||
|
else
|
||||||
|
template=partman-basicfilesystems/progress_formatting
|
||||||
|
fi
|
||||||
|
open_dialog PARTITION_INFO $id
|
||||||
|
read_line x1 x2 x3 x4 x5 device x6
|
||||||
|
close_dialog
|
||||||
|
|
||||||
|
RET=''
|
||||||
|
db_metaget partman/filesystem_short/"$filesystem" description || RET=''
|
||||||
|
[ "$RET" ] || RET="$filesystem"
|
||||||
|
db_subst $template TYPE "$RET"
|
||||||
|
db_subst $template PARTITION "$num"
|
||||||
|
db_subst $template DEVICE $(humandev $(cat device))
|
||||||
|
|
||||||
|
db_progress START 0 3 partman/text/formatting
|
||||||
|
db_progress INFO $template
|
||||||
|
db_progress SET 1
|
||||||
|
|
||||||
|
label=''
|
||||||
|
if [ -f $id/label ]; then
|
||||||
|
label=$(cat $id/label | \
|
||||||
|
sed 's/\(............\).*/\1/g')
|
||||||
|
fi
|
||||||
|
code=0
|
||||||
|
# Ensure label is quoted correctly
|
||||||
|
log-output -t partman --pass-stdout \
|
||||||
|
mkfs.btrfs ${label:+-L "$label"} \
|
||||||
|
$device >/dev/null || code=$?
|
||||||
|
sync
|
||||||
|
db_progress STOP
|
||||||
|
|
||||||
|
if [ "$code" != 0 ]; then
|
||||||
|
db_subst partman-btrfs/create_failed PARTITION "$num"
|
||||||
|
db_subst partman-btrfs/create_failed DEVICE $(humandev $(cat device))
|
||||||
|
db_input critical partman-btrfs/create_failed || true
|
||||||
|
db_go || true
|
||||||
|
#disable_swap
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
>$id/formatted
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
#disable_swap
|
||||||
6
debian/changelog
vendored
Normal file
6
debian/changelog
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
partman-btrfs (1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* Took partman-xfs and s/xfs/btrfs/, essentially.
|
||||||
|
* Added error messages if /boot is on btrfs.
|
||||||
|
|
||||||
|
-- Joey Hess <joeyh@debian.org> Thu, 4 Mar 2004 12:42:40 -0500
|
||||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
7
|
||||||
14
debian/control
vendored
Normal file
14
debian/control
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
Source: partman-btrfs
|
||||||
|
Section: debian-installer
|
||||||
|
Priority: standard
|
||||||
|
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
|
||||||
|
Uploaders: Anton Zinoviev <zinoviev@debian.org>, Joey Hess <joeyh@debian.org>
|
||||||
|
Build-Depends: debhelper (>= 7.0.8), dh-di, po-debconf (>= 0.5.0)
|
||||||
|
Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/partman/partman-btrfs
|
||||||
|
|
||||||
|
Package: partman-btrfs
|
||||||
|
XC-Package-Type: udeb
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}, btrfs-tools-udeb, btrfs-modules, partman-basicfilesystems (>= 59), partman-base (>= 124)
|
||||||
|
Provides: partman-filesystem
|
||||||
|
Description: Add to partman support for btrfs
|
||||||
4
debian/copyright
vendored
Normal file
4
debian/copyright
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
This package is under the GNU GPL version 2, or any later
|
||||||
|
version at your option.
|
||||||
|
On Debian system, the GPL is available in
|
||||||
|
/usr/share/common-licenses/GPL-2
|
||||||
7
debian/di-numbers
vendored
Normal file
7
debian/di-numbers
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
active_partition lib/partman
|
||||||
|
valid_filesystems lib/partman
|
||||||
|
init.d lib/partman
|
||||||
|
check.d lib/partman
|
||||||
|
commit.d lib/partman
|
||||||
|
finish.d lib/partman
|
||||||
|
mount.d lib/partman
|
||||||
3
debian/install
vendored
Normal file
3
debian/install
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
mountoptions lib/partman
|
||||||
|
fstab.d lib/partman
|
||||||
|
parted_names lib/partman
|
||||||
73
debian/partman-btrfs.templates
vendored
Normal file
73
debian/partman-btrfs.templates
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
Template: partman-btrfs/progress_checking
|
||||||
|
Type: text
|
||||||
|
# :sl2:
|
||||||
|
_Description: Checking the btrfs file system in partition #${PARTITION} of ${DEVICE}...
|
||||||
|
|
||||||
|
Template: partman-btrfs/check_failed
|
||||||
|
Type: boolean
|
||||||
|
# :sl2:
|
||||||
|
_Description: Go back to the menu and correct errors?
|
||||||
|
The test of the file system with type btrfs in partition #${PARTITION}
|
||||||
|
of ${DEVICE} found uncorrected errors.
|
||||||
|
.
|
||||||
|
If you do not go back to the partitioning menu and correct these errors,
|
||||||
|
the partition will not be used at all.
|
||||||
|
|
||||||
|
Template: partman-btrfs/create_failed
|
||||||
|
Type: error
|
||||||
|
# :sl2:
|
||||||
|
_Description: Failed to create a file system
|
||||||
|
The btrfs file system creation in partition
|
||||||
|
#${PARTITION} of ${DEVICE} failed.
|
||||||
|
|
||||||
|
Template: partman-btrfs/no_mount_point
|
||||||
|
Type: boolean
|
||||||
|
# :sl2:
|
||||||
|
_Description: Do you want to return to the partitioning menu?
|
||||||
|
No mount point is assigned for the btrfs file system in partition
|
||||||
|
#${PARTITION} of ${DEVICE}.
|
||||||
|
.
|
||||||
|
If you do not go back to the partitioning menu and assign a mount point
|
||||||
|
from there, this partition will not be used at all.
|
||||||
|
|
||||||
|
Template: partman-btrfs/text/specify_mountpoint
|
||||||
|
Type: text
|
||||||
|
# :sl2:
|
||||||
|
# This is an item in the menu "Partition settings"
|
||||||
|
_Description: Mount point:
|
||||||
|
|
||||||
|
Template: partman-btrfs/text/btrfs
|
||||||
|
Type: text
|
||||||
|
# :sl2:
|
||||||
|
# File system name (untranslatable in many languages)
|
||||||
|
_Description: btrfs
|
||||||
|
|
||||||
|
Template: partman/filesystem_long/btrfs
|
||||||
|
Type: text
|
||||||
|
# :sl2:
|
||||||
|
# File system name
|
||||||
|
_Description: btrfs journaling file system
|
||||||
|
|
||||||
|
Template: partman/filesystem_short/btrfs
|
||||||
|
Type: text
|
||||||
|
# :sl1:
|
||||||
|
# Short file system name (untranslatable in many languages)
|
||||||
|
_Description: btrfs
|
||||||
|
|
||||||
|
Template: partman-btrfs/btrfs_root
|
||||||
|
Type: error
|
||||||
|
# :sl2:
|
||||||
|
_Description: btrfs root file system not supported without separate /boot
|
||||||
|
Your root file system is a btrfs file system. This is not supported
|
||||||
|
by the boot loader used by default by this installer.
|
||||||
|
.
|
||||||
|
You should use a small /boot partition with another file system, such as ext3.
|
||||||
|
|
||||||
|
Template: partman-btrfs/btrfs_boot
|
||||||
|
Type: error
|
||||||
|
# :sl2:
|
||||||
|
_Description: btrfs file system not supported for /boot
|
||||||
|
You have mounted a btrfs file system as /boot. This is not supported
|
||||||
|
by the boot loader used by default by this installer.
|
||||||
|
.
|
||||||
|
You should use another file system, such as ext3, for the /boot partition.
|
||||||
3
debian/rules
vendored
Executable file
3
debian/rules
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#! /usr/bin/make -f
|
||||||
|
%:
|
||||||
|
dh --with d-i $@
|
||||||
1
finish.d/_numbers
Normal file
1
finish.d/_numbers
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
70 aptinstall_btrfs
|
||||||
27
finish.d/aptinstall_btrfs
Executable file
27
finish.d/aptinstall_btrfs
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
|
btrfs=no
|
||||||
|
|
||||||
|
for dev in $DEVICES/*; do
|
||||||
|
[ -d "$dev" ] || continue
|
||||||
|
cd $dev
|
||||||
|
partitions=
|
||||||
|
open_dialog PARTITIONS
|
||||||
|
while { read_line num id size type fs path name; [ "$id" ]; }; do
|
||||||
|
[ "$fs" != free ] || continue
|
||||||
|
[ -f $id/method -a -f $id/acting_filesystem ] || continue
|
||||||
|
filesystem=$(cat $id/acting_filesystem)
|
||||||
|
case $filesystem in
|
||||||
|
btrfs)
|
||||||
|
btrfs=yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
close_dialog
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$btrfs" = yes ]; then
|
||||||
|
apt-install btrfs-tools || true
|
||||||
|
fi
|
||||||
39
fstab.d/btrfs
Executable file
39
fstab.d/btrfs
Executable file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/partman/lib/base.sh
|
||||||
|
|
||||||
|
for dev in $DEVICES/*; do
|
||||||
|
[ -d $dev ] || continue
|
||||||
|
cd $dev
|
||||||
|
open_dialog PARTITIONS
|
||||||
|
while { read_line num id size type fs path name; [ "$id" ]; }; do
|
||||||
|
[ $fs != free ] || continue
|
||||||
|
[ -f "$id/method" ] || continue
|
||||||
|
[ -f "$id/acting_filesystem" ] || continue
|
||||||
|
method=$(cat $id/method)
|
||||||
|
filesystem=$(cat $id/acting_filesystem)
|
||||||
|
case "$filesystem" in
|
||||||
|
btrfs)
|
||||||
|
[ -f "$id/mountpoint" ] || continue
|
||||||
|
mountpoint=$(cat $id/mountpoint)
|
||||||
|
# due to #249322, #255135, #258117:
|
||||||
|
if [ "$mountpoint" = /tmp ]; then
|
||||||
|
rm -f $id/options/noexec
|
||||||
|
fi
|
||||||
|
options=$(get_mountoptions $dev $id)
|
||||||
|
if [ "$mountpoint" = / ]; then
|
||||||
|
if [ "$options" = defaults ]; then
|
||||||
|
options="errors=remount-ro"
|
||||||
|
else
|
||||||
|
options="${options},errors=remount-ro"
|
||||||
|
fi
|
||||||
|
pass=1
|
||||||
|
else
|
||||||
|
pass=2
|
||||||
|
fi
|
||||||
|
echo "$path" "$mountpoint" btrfs $options 0 $pass
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
close_dialog
|
||||||
|
done
|
||||||
1
init.d/_numbers
Normal file
1
init.d/_numbers
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
03 kernelmodules_btrfs
|
||||||
20
init.d/kernelmodules_btrfs
Executable file
20
init.d/kernelmodules_btrfs
Executable file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
mkdir -p /var/lib/partman
|
||||||
|
|
||||||
|
cat /proc/modules |
|
||||||
|
while read module_name x; do
|
||||||
|
if [ "$module_name" = btrfs ]; then
|
||||||
|
>/var/lib/partman/btrfs
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if modprobe btrfs >/dev/null 2>/dev/null; then
|
||||||
|
>/var/lib/partman/btrfs
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q btrfs /proc/filesystems; then
|
||||||
|
>/var/lib/partman/btrfs
|
||||||
|
fi
|
||||||
1
mount.d/_numbers
Normal file
1
mount.d/_numbers
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
70 btrfs
|
||||||
20
mount.d/btrfs
Executable file
20
mount.d/btrfs
Executable file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -- $1
|
||||||
|
|
||||||
|
fs=$1
|
||||||
|
mp=$2
|
||||||
|
type=$3
|
||||||
|
options=$4
|
||||||
|
dump=$5
|
||||||
|
pass=$6
|
||||||
|
|
||||||
|
case $type in
|
||||||
|
btrfs)
|
||||||
|
mount -t btrfs ${options:+-o "$options"} $fs /target$mp || exit 1
|
||||||
|
echo "umount /target$mp"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 1
|
||||||
17
mountoptions/btrfs
Normal file
17
mountoptions/btrfs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
noatime
|
||||||
|
relatime
|
||||||
|
nodev
|
||||||
|
nosuid
|
||||||
|
noexec
|
||||||
|
ro
|
||||||
|
sync
|
||||||
|
usrquota
|
||||||
|
grpquota
|
||||||
|
nodatasum
|
||||||
|
nodatacow
|
||||||
|
nobarrier
|
||||||
|
compress
|
||||||
|
ssd
|
||||||
|
noacl
|
||||||
|
notreelog
|
||||||
|
flushoncommit
|
||||||
1
parted_names/btrfs
Normal file
1
parted_names/btrfs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
btrfs
|
||||||
1
valid_filesystems/_numbers
Normal file
1
valid_filesystems/_numbers
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
25 btrfs
|
||||||
25
valid_filesystems/btrfs
Executable file
25
valid_filesystems/btrfs
Executable file
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
dev=$1
|
||||||
|
id=$2
|
||||||
|
property=$3
|
||||||
|
|
||||||
|
[ -f /var/lib/partman/btrfs ] || exit 0
|
||||||
|
|
||||||
|
case $property in
|
||||||
|
formatable)
|
||||||
|
echo btrfs
|
||||||
|
;;
|
||||||
|
existing)
|
||||||
|
[ -f $id/detected_filesystem ] || exit 0
|
||||||
|
fs=$(cat $id/detected_filesystem)
|
||||||
|
|
||||||
|
case "$fs" in
|
||||||
|
btrfs)
|
||||||
|
echo btrfs
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue