Attached a set of patches split into 3 sets that add very basic support for dmraid to D-I. Although the support as a whole is very experimental, the changes to existing udebs are fairly small and relatively clean.
Although there are still some issues, I think the current code is ready to
be committed and used as an experimental feature. I feel it is a good
basis to improve support later. Current code has been tested fairly
extensively (also on non-dmraid installs).
Some characteristics:
- dmraid support is only enabled if 'disk-detect/dmraid/enable=true' or
the alias 'dmraid=true' are passed at the boot prompt
- dialogs and error handling still need some work
- partman will:
- not show the physical disks that make up the fake RAID device
- show the device-mapper device corresponding to the fake RAID device
with below that its partitions; this can be partitioned, but can not
be used to set "usage" information (file system, mount point)
- show separate device-mapper devices for each partition with below
that the usage information for that partition
- changes in partitioning for the fake RAID device need to be committed
"manually" using a separate menu item
- os-prober will skip physical disks that are part of a fake RAID device;
as the fake RAID itself is not supported, that effectively means no
os-probing support
- grub is supported as bootloader, but as grub-install can not be used,
grub-installer effectively installs grub manually to the MBR of the
fake RAID
The patches are as follows:
- other udebs:
- hw-detect: add dmraid support in disk-detect is enabled at boot prompt
- preseed: add alias for disk-detect enable option
- base-installer: create device-mapper devices and load dmraid in target
- os-prober: skip disks that are part of fake RAID
- grub-installer: add semi-manual support to install grub on fake RAID
- partman-dmraid:
- new component with dmraid-specific support bits
- during init.d a flag is set for the "whole disk" fake RAID device,
which is used in other places
- in choose-partitions.d the menu item is added to commit partitioning
changes to the fake RAID device
- other partman:
- partman-base: basic recognition and display of fake RAID devices; skip
the physical disks that make up the fake RAID
- others: avoid "using" anything on the fake RAID device itself
Issues
------
Main issue is that partman should handle the dmraid devices better and
present them as a single unit instead of the current hackish way of
dealing with them.
Current solution also results in a wrong display of the first dmraid
partition (the one that has grub installed on it as "free space".
For the grub installation I currently assume that the installation is to
the fake RAID device and that the grub root is the first partition. I
plan to work on this a bit more before committing.
ToDo
----
- the dialogs still need some work
- some error checking could probably be added in current code
- modify grub-installer to support installation to other partitions
than the first
- modify grub-installer to support having the grub root on a different
device than the fake RAID
- add real support in partman and grub
Comments welcome.
Cheers,
FJP
Index: hw-detect/debian/changelog
===================================================================
--- hw-detect/debian/changelog (revision 47287)
+++ hw-detect/debian/changelog (working copy)
@@ -1,5 +1,6 @@
hw-detect (1.54) UNRELEASED; urgency=low
+ [ Joey Hess ]
* Remove cruft left over from the days of pcmcia-cs.
- pcmciautils doesn't create a cardmgr.pid, so stop looking for it to
determine if pcmcia is started. Look for the pcmcia_core module being
@@ -11,8 +12,12 @@
- Only modify config.opts in /target if pcmcia_resources is preseeded.
* Remove workaround for long fixed cdebconf bug.
- -- Joey Hess <[EMAIL PROTECTED]> Sun, 27 May 2007 01:53:09 -0400
+ [ Frans Pop ]
+ * disk-detect: detect fake (ata) RAID devices using dmraid if requested
+ by setting disk-detect/dmraid/enable at the boot prompt.
+ -- Frans Pop <[EMAIL PROTECTED]> Thu, 14 Jun 2007 19:55:28 +0200
+
hw-detect (1.53) unstable; urgency=low
[ Joey Hess ]
Index: hw-detect/debian/disk-detect.templates
===================================================================
--- hw-detect/debian/disk-detect.templates (revision 47287)
+++ hw-detect/debian/disk-detect.templates (working copy)
@@ -24,3 +24,9 @@
No partitionable media were found.
.
Please check that a hard disk is attached to this machine.
+
+Template: disk-detect/dmraid/enable
+Type: boolean
+Default: false
+Description: for internal use; can be preseeded
+ Check for the presence of fake (ata) RAID (dmraid) devices?
Index: hw-detect/disk-detect.sh
===================================================================
--- hw-detect/disk-detect.sh (revision 47287)
+++ hw-detect/disk-detect.sh (working copy)
@@ -114,7 +114,7 @@
db_get disk-detect/module_select
if [ "$RET" = "continue with no disk drive" ]; then
- break
+ exit 0
elif [ "$RET" != "none of the above" ]; then
module="$RET"
if [ -n "$module" ] && is_not_loaded "$module" ; then
@@ -147,3 +147,21 @@
fi
db_capb
done
+
+# Activate fake (ata) raid devices
+db_get disk-detect/dmraid/enable
+if [ $RET = true ]; then
+ if anna-install dmraid-udeb; then
+ # Device mapper support is required to run dmraid
+ if is_not_loaded dm-mod; then
+ module_probe dm-mod
+ fi
+
+ if [ "$(dmraid -c -s)" != "No RAID disks" ]; then
+ anna-install partman-dmraid
+
+ # Activate devices
+ log-output -t disk-detect dmraid -ay
+ fi
+ fi
+fi
Index: preseed/debian/changelog
===================================================================
--- preseed/debian/changelog (revision 47287)
+++ preseed/debian/changelog (working copy)
@@ -1,3 +1,9 @@
+preseed (1.30) UNRELEASED; urgency=low
+
+ * Add alias 'dmraid' to enable fake RAID support.
+
+ -- Frans Pop <[EMAIL PROTECTED]> Mon, 18 Jun 2007 10:02:03 +0200
+
preseed (1.29) unstable; urgency=low
[ Colin Watson ]
Index: preseed/preseed_aliases
===================================================================
--- preseed/preseed_aliases (revision 47287)
+++ preseed/preseed_aliases (working copy)
@@ -13,3 +13,4 @@
suite mirror/suite
modules anna/choose_modules
tasks tasksel:tasksel/first
+dmraid disk-detect/dmraid/enable
Index: base-installer/debian/postinst
===================================================================
--- base-installer/debian/postinst (revision 47287)
+++ base-installer/debian/postinst (working copy)
@@ -340,6 +340,18 @@
minor="$(dmsetup -c --noheadings info $rootnode | cut -d':' -f3)"
mknod /target/dev/mapper/$rootnode b $major $minor
fi
+
+ # Create device nodes for fake (ata) RAID devices
+ if type dmraid >/dev/null 2>&1; then
+ for frdisk in $(dmraid -s -c | grep -v "No RAID disks"); do
+ for frdev in $(ls /dev/mapper/$frdisk* 2>/dev/null); do
+ frnode=$(basename $frdev)
+ major="$(dmsetup -c --noheadings info $frnode | cut -d':' -f2)"
+ minor="$(dmsetup -c --noheadings info $frnode | cut -d':' -f3)"
+ mknod /target/dev/mapper/$frnode b $major $minor
+ done
+ done
+ fi
fi
# We can't check the root node directly as is done above because
@@ -349,6 +361,12 @@
apt-install cryptsetup
fi
+ if type dmraid >/dev/null 2>&1; then
+ if [ "$(dmraid -s -c | grep -v "No RAID disks")" ]; then
+ apt-install dmraid
+ fi
+ fi
+
if pvdisplay | grep -iq "physical volume ---"; then
apt-install lvm2
in-target vgscan --mknodes || true
Index: base-installer/debian/changelog
===================================================================
--- base-installer/debian/changelog (revision 47287)
+++ base-installer/debian/changelog (working copy)
@@ -1,10 +1,15 @@
base-installer (1.81) UNRELEASED; urgency=low
+ [ Otavio Salvador ]
* Provides installed-base. This is need to be able to use alternative
ways of installing Debian.
- -- Otavio Salvador <[EMAIL PROTECTED]> Sun, 17 Jun 2007 10:02:39 -0300
+ [ Frans Pop ]
+ * Load dmraid if needed; create device nodes in /target for fake (ata)
+ RAID devices.
+ -- Frans Pop <[EMAIL PROTECTED]> Fri, 15 Jun 2007 15:07:17 +0200
+
base-installer (1.80) unstable; urgency=low
[ Frans Pop ]
Index: os-prober/debian/changelog
===================================================================
--- os-prober/debian/changelog (revision 47287)
+++ os-prober/debian/changelog (working copy)
@@ -1,13 +1,18 @@
os-prober (1.19) UNRELEASED; urgency=low
+ [ Joey Hess ]
* Make the microsoft OS test completely case-insensative in the file and
directory named it looks for. This is reportedly needed at least for
Vista (Boot/BCD vs boot/bcd), and was already done on an ad-hoc basis
for 2000/XP/NT4.0.
* Patch from VMiklos to add support for recognising Frugalware.
- -- Joey Hess <[EMAIL PROTECTED]> Sun, 03 Jun 2007 11:54:59 -0400
+ [ Frans Pop ]
+ * Skip partitions that are on a disk that is part of a fake (ata) RAID
+ device.
+ -- Frans Pop <[EMAIL PROTECTED]> Sat, 16 Jun 2007 10:05:46 +0200
+
os-prober (1.18) unstable; urgency=low
* Add detection for Dell Utility partition (can be chainloaded).
Index: os-prober/os-prober
===================================================================
--- os-prober/os-prober (revision 47287)
+++ os-prober/os-prober (working copy)
@@ -3,10 +3,22 @@
. /usr/share/os-prober/common.sh
+on_fakeraid () {
+ type dmraid >/dev/null 2>&1 || return 1
+ local parent=${1%/*}
+ local device=/dev/${parent##*/}
+ if dmraid -r -c | grep -q $device; then
+ return 0
+ fi
+ return 1
+}
+
partitions () {
+ # Exclude partitions that are on devices that are part of a fake
+ # (ata) RAID device. TODO: add support for the fake RAID itself.
if [ -d /sys/block ]; then
for part in /sys/block/*/*[0-9]; do
- if [ -f "$part/start" ]; then
+ if [ -f "$part/start" ] && ! on_fakeraid $part; then
name="$(echo "${part##*/}" | sed 's,[!.],/,g')"
if [ -e "/dev/$name" ]; then
echo "/dev/$name"
Index: arch/i386/grub-installer/debian/isinstallable
===================================================================
--- arch/i386/grub-installer/debian/isinstallable (revision 47287)
+++ arch/i386/grub-installer/debian/isinstallable (working copy)
@@ -13,6 +13,17 @@
mount | grep "on /target${1%/} " | cut -d' ' -f5
}
+is_fakeraid () {
+ if type dmraid >/dev/null 2>&1; then
+ for frdisk in $(dmraid -s -c | grep -v "No RAID disks"); do
+ if echo "$1" | grep "/$frdisk[0-9]\+"; then
+ return 0
+ fi
+ done
+ fi
+ return 1
+}
+
ARCH="$(archdetect)"
case $ARCH in
@@ -36,8 +47,10 @@
# Check for the control file to work around lvdisplay refusal to work with
# certian lvm device names.
if lvdisplay "$bootfs" | grep -q 'LV Name' 2>/dev/null || [ -e "$(dirname $bootfs)/control" ]; then
- log "/boot is a lvm volume ($bootfs), cannot install grub"
- exit 1
+ if ! is_fakeraid $bootfs; then
+ log "/boot is a lvm volume ($bootfs), cannot install grub"
+ exit 1
+ fi
fi
bootfstype=$(findfstype /boot)
Index: arch/i386/grub-installer/debian/changelog
===================================================================
--- arch/i386/grub-installer/debian/changelog (revision 47287)
+++ arch/i386/grub-installer/debian/changelog (working copy)
@@ -9,8 +9,11 @@
* When installing with GRUB 2, adjust otheros entry writing to the
interface provided by new update-grub. (Closes: #423393)
- -- Robert Millan <[EMAIL PROTECTED]> Sun, 17 Jun 2007 20:48:50 +0200
+ [ Frans Pop ]
+ * Fix incorrect detection of fake RAID devices (dmraid) as LVM volumes.
+ -- Frans Pop <[EMAIL PROTECTED]> Mon, 18 Jun 2007 10:06:45 +0200
+
grub-installer (1.24) unstable; urgency=low
* Fix syntax error in grub-installer script.
Index: arch/i386/grub-installer/debian/grub-installer.templates
===================================================================
--- arch/i386/grub-installer/debian/grub-installer.templates (revision 47287)
+++ arch/i386/grub-installer/debian/grub-installer.templates (working copy)
@@ -23,6 +23,22 @@
that operating system temporarily unbootable, though GRUB can be manually
configured later to boot it.
+Template: grub-installer/fakeraid
+Type: boolean
+Default: true
+Description: Install the GRUB boot loader to the fake RAID disk?
+ Installation of GRUB on a fake (ata) RAID disk is not really
+ supported, but it is possible. The installation is currently experimental
+ and will always be done on the MBR of the fake RAID disk.
+ .
+ Choose <Go Back> to cancel this operation.
+
+Template: grub-installer/fakeraid
+Type: error
+Description: Configuration not supported
+ The installer has detected the presence of multiple fake RAID disks, which
+ is currently not supported.
+
Template: grub-installer/install_to_xfs
Type: boolean
Default: false
Index: arch/i386/grub-installer/grub-installer
===================================================================
--- arch/i386/grub-installer/grub-installer (revision 47287)
+++ arch/i386/grub-installer/grub-installer (working copy)
@@ -237,6 +237,9 @@
/dev/md)
disc_offered_devfs="$bootfs"
;;
+ /dev/mapper)
+ disc_offered_devfs="$bootfs"
+ ;;
/dev/[hs]d[a-z]|/dev/cciss/c[0-9]d[0-9]|/dev/ida/c[0-9]d[0-9])
disc_offered_devfs="$prefix"
;;
@@ -383,6 +386,16 @@
state=1
fi
+nr_frdisks="$(dmraid -s -c | grep -v "No RAID disks" | wc -l)"
+if [ $nr_frdisks -eq 1 ]; then
+ q=grub-installer/fakeraid
+ frdisk=$(dmraid -s -c)
+elif [ $nr_frdisks -gt 1 ]; then
+ db_input critical grub-installer/fakeraid-unsupported || [ $? -eq 30 ]
+ db_go || true
+ exit 1
+fi
+
db_progress STEP 1
db_progress INFO grub-installer/progress/step_bootdev
@@ -433,31 +446,65 @@
update_mtab
-# Install grub on each space separated disk in the list
-bootdevs="$bootdev"
-for bootdev in $bootdevs; do
- if ! is_floppy "$bootdev"; then
- if $chroot $ROOT grub-install -h 2>&1 | grep -q no-floppy; then
- info "grub-install supports --no-floppy"
- floppyparam="--no-floppy"
+if [ -z "$frdisk" ]; then
+
+ # Install grub on each space separated disk in the list
+ bootdevs="$bootdev"
+ for bootdev in $bootdevs; do
+ if ! is_floppy "$bootdev"; then
+ if $chroot $ROOT grub-install -h 2>&1 | grep -q no-floppy; then
+ info "grub-install supports --no-floppy"
+ floppyparam="--no-floppy"
+ else
+ info "grub-install does not support --no-floppy"
+ fi
+ fi
+
+ info "Running $chroot $ROOT grub-install --recheck $floppyparam \"$bootdev\""
+ if log-output -t grub-installer $chroot $ROOT grub-install --recheck $floppyparam "$bootdev"; then
+ info "grub-install ran successfully"
else
- info "grub-install does not support --no-floppy"
+ error "Running 'grub-install --recheck $floppyparam \"$bootdev\"' failed."
+ db_subst grub-installer/grub-install-failed BOOTDEV "$bootdev"
+ db_input critical grub-installer/grub-install-failed || [ $? -eq 30 ]
+ db_go || true
+ db_progress STOP
+ exit 1
fi
- fi
+ done
- info "Running $chroot $ROOT grub-install --recheck $floppyparam \"$bootdev\""
- if log-output -t grub-installer $chroot $ROOT grub-install --recheck $floppyparam "$bootdev"; then
- info "grub-install ran successfully"
- else
- error "Running 'grub-install --recheck $floppyparam \"$bootdev\"' failed."
- db_subst grub-installer/grub-install-failed BOOTDEV "$bootdev"
- db_input critical grub-installer/grub-install-failed || [ $? -eq 30 ]
- db_go || true
- db_progress STOP
+else
+
+ # Semi-manual grub setup for a fake (ata) RAID disk
+ case $(archdetect) in
+ i386/*)
+ stagedir=i386-pc ;;
+ amd64/*)
+ stagedir=x86_64-pc ;;
+ *)
+ error "Unsupported architecture for fake RAID installation"
exit 1
+ ;;
+ esac
+ if [ ! -d $ROOT/usr/lib/grub/$stagedir/ ]; then
+ error "Grub stage files not available"
+ exit 1
fi
-done
+ mkdir -p /target/boot/grub
+ cp $ROOT/usr/lib/grub/$stagedir/* $ROOT/boot/grub
+ # TODO: Check for errors during this process!
+ TERM=linux $chroot $ROOT \
+ grub --device-map=/dev/null >/var/log/grub-dmraid.log 2>&1 </dev/null <<EOF
+device (hd0,0) /dev/mapper/${frdisk}1
+device (hd0) /dev/mapper/$frdisk
+root (hd0,0)
+setup (hd0,0)
+quit
+EOF
+
+fi
+
db_progress STEP 1
db_progress INFO grub-installer/progress/step_config_loader
Index: partman/partman-dmraid/debian/control =================================================================== --- partman/partman-dmraid/debian/control (revision 0) +++ partman/partman-dmraid/debian/control (revision 0) @@ -0,0 +1,13 @@ +Source: partman-dmraid +Section: debian-installer +Priority: standard +Maintainer: Debian Install System Team <[email protected]> +Uploaders: Frans Pop <[EMAIL PROTECTED]> +Build-Depends: debhelper (>= 4.2.0), po-debconf (>= 0.5.0) +XS-Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/partman/partman-dmraid + +Package: partman-dmraid +XC-Package-Type: udeb +Architecture: all +Depends: ${misc:Depends}, partman-base, di-utils (>= 1.14), dmraid-udeb, dmsetup-udeb +Description: Adds support for fake (ata) RAID (dmraid) to partman Index: partman/partman-dmraid/debian/compat =================================================================== --- partman/partman-dmraid/debian/compat (revision 0) +++ partman/partman-dmraid/debian/compat (revision 0) @@ -0,0 +1 @@ +4 Index: partman/partman-dmraid/debian/changelog =================================================================== --- partman/partman-dmraid/debian/changelog (revision 0) +++ partman/partman-dmraid/debian/changelog (revision 0) @@ -0,0 +1,9 @@ +partman-dmraid (1) UNRELEASED; urgency=low + + * Initial version. + + -- Frans Pop <[EMAIL PROTECTED]> Fri, 15 Jun 2007 13:00:24 +0200 + +Local Variables: +coding: utf-8 +End: Index: partman/partman-dmraid/debian/copyright =================================================================== --- partman/partman-dmraid/debian/copyright (revision 0) +++ partman/partman-dmraid/debian/copyright (revision 0) @@ -0,0 +1,6 @@ +Authors: Frans Pop + +Copyright 2007 Frans Pop <[EMAIL PROTECTED]> + +This package is under the GNU General Public License, version 2, which can +usually be found in /usr/share/common-licenses/GPL-2 on Debian systems. Index: partman/partman-dmraid/debian/install-rc =================================================================== --- partman/partman-dmraid/debian/install-rc (revision 0) +++ partman/partman-dmraid/debian/install-rc (revision 0) @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +# PACKAGE is exported from debian/rules +partman=debian/${PACKAGE}/lib/partman + +install -d $partman/$1 + +cp -r $1/* $partman/$1/ + +# Remove any SVN dirs that were copied along +rm -rf `find $partman/$1/ -name .svn` + +if [ -f $partman/$1/_numbers ]; then + numbers=$(cat $partman/$1/_numbers) + rm $partman/$1/_numbers + echo "$numbers" | + while read number name; do + set -e + mv $partman/$1/$name $partman/$1/${number}${name} + done +fi + Property changes on: partman/partman-dmraid/debian/install-rc ___________________________________________________________________ Name: svn:executable + * Index: partman/partman-dmraid/debian/rules =================================================================== --- partman/partman-dmraid/debian/rules (revision 0) +++ partman/partman-dmraid/debian/rules (revision 0) @@ -0,0 +1,38 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export PACKAGE = partman-dmraid + +build: +# Ye olde no-op. + +clean: + dh_testdir + dh_testroot + rm -f `find . -name '*~'` + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + debian/install-rc choose_partition + debian/install-rc init.d + +binary-indep: build install + dh_testdir + dh_testroot + dh_installdebconf + dh_fixperms + dh_installdeb + dh_gencontrol + dh_builddeb + +binary-arch: build install + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install Property changes on: partman/partman-dmraid/debian/rules ___________________________________________________________________ Name: svn:executable + * Index: partman/partman-dmraid/debian/source.lintian-overrides =================================================================== --- partman/partman-dmraid/debian/source.lintian-overrides (revision 0) +++ partman/partman-dmraid/debian/source.lintian-overrides (revision 0) @@ -0,0 +1 @@ +no-standards-version-field Index: partman/partman-dmraid/debian/partman-dmraid.templates =================================================================== --- partman/partman-dmraid/debian/partman-dmraid.templates (revision 0) +++ partman/partman-dmraid/debian/partman-dmraid.templates (revision 0) @@ -0,0 +1,47 @@ +Template: partman-dmraid/menu/finish +Type: text +# Menu entry +# Use infinitive form +_Description: Finish + +Template: partman-dmraid/confirm +Type: boolean +Default: false +#flag:translate!:4 +_Description: Write changes in fake raid partitioning to disk? + Any changes you have made in the partitioning of your fake (ata) RAID + devices need to be written to disk before the partitions can be used. + Any other pending changes will be written to disk as well. These changes + cannot be undone. + . + ${ITEMS} + +Template: partman-dmraid/confirm_nochanges +Type: note +_Description: No pending changes + There are no changes to commit. + +Template: partman-dmraid/commit_failed +Type: error +_Description: + An error occurred while writing the changes to the disks. + +Template: partman-dmraid/progress/createfs/title +Type: text +_Description: Creating initial filesystem + +Template: partman-dmraid/progress/createfs/info +Type: text +_Description: Creating initial ext2 filesystem on ${DEVICE}... + +Template: partman-dmraid/text/commit_dmraid +Type: text +# Main menu item +# Use infinitive form +_Description: Write changes in fake RAID partitioning to disk + +Template: debian-installer/partman-dmraid/title +Type: text +# Main menu item +# Use infinitive form +_Description: Write changes in fake RAID partitioning to disk Index: partman/partman-dmraid/debian/po/templates.pot =================================================================== --- partman/partman-dmraid/debian/po/templates.pot (revision 0) +++ partman/partman-dmraid/debian/po/templates.pot (revision 0) @@ -0,0 +1,89 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <[EMAIL PROTECTED]>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: [EMAIL PROTECTED]" +"POT-Creation-Date: 2007-06-18 20:27+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n" +"Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: text +#. Description +#. Menu entry +#. Use infinitive form +#: ../partman-dmraid.templates:1001 +msgid "Finish" +msgstr "" + +#. Type: boolean +#. Description +#: ../partman-dmraid.templates:2001 +msgid "Write changes in fake raid partitioning to disk?" +msgstr "" + +#. Type: boolean +#. Description +#: ../partman-dmraid.templates:2001 +msgid "" +"Any changes you have made in the partitioning of your fake (ata) RAID " +"devices need to be written to disk before the partitions can be used. Any " +"other pending changes will be written to disk as well. These changes cannot " +"be undone." +msgstr "" + +#. Type: boolean +#. Description +#: ../partman-dmraid.templates:2001 +msgid "${ITEMS}" +msgstr "" + +#. Type: note +#. Description +#: ../partman-dmraid.templates:3001 +msgid "No pending changes" +msgstr "" + +#. Type: note +#. Description +#: ../partman-dmraid.templates:3001 +msgid "There are no changes to commit." +msgstr "" + +#. Type: error +#. Description +#: ../partman-dmraid.templates:4001 +msgid "An error occurred while writing the changes to the disks." +msgstr "" + +#. Type: text +#. Description +#: ../partman-dmraid.templates:5001 +msgid "Creating initial filesystem" +msgstr "" + +#. Type: text +#. Description +#: ../partman-dmraid.templates:6001 +msgid "Creating initial ext2 filesystem on ${DEVICE}..." +msgstr "" + +#. Type: text +#. Description +#. Main menu item +#. Use infinitive form +#. Type: text +#. Description +#. Main menu item +#. Use infinitive form +#: ../partman-dmraid.templates:7001 ../partman-dmraid.templates:8001 +msgid "Write changes in fake RAID partitioning to disk" +msgstr "" Index: partman/partman-dmraid/debian/po/output =================================================================== --- partman/partman-dmraid/debian/po/output (revision 0) +++ partman/partman-dmraid/debian/po/output (revision 0) @@ -0,0 +1 @@ +2 utf8 Index: partman/partman-dmraid/debian/po/POTFILES.in =================================================================== --- partman/partman-dmraid/debian/po/POTFILES.in (revision 0) +++ partman/partman-dmraid/debian/po/POTFILES.in (revision 0) @@ -0,0 +1 @@ +[type: gettext/rfc822deb] partman-dmraid.templates Index: partman/partman-dmraid/init.d/fakeraid_flag =================================================================== --- partman/partman-dmraid/init.d/fakeraid_flag (revision 0) +++ partman/partman-dmraid/init.d/fakeraid_flag (revision 0) @@ -0,0 +1,18 @@ +#!/bin/sh + +# This script sets the fakeraid flag for devices that are recognized by dmraid + +for dev in /var/lib/partman/devices/*; do + [ -d "$dev" ] || continue + cd $dev + + [ -f device ] || continue + for frdisk in $(dmraid -s -c | grep -v "No RAID disks"); do + case $(cat device) in + /dev/mapper/$frdisk) + >fakeraid + break + ;; + esac + done +done Property changes on: partman/partman-dmraid/init.d/fakeraid_flag ___________________________________________________________________ Name: svn:executable + * Index: partman/partman-dmraid/init.d/_numbers =================================================================== --- partman/partman-dmraid/init.d/_numbers (revision 0) +++ partman/partman-dmraid/init.d/_numbers (revision 0) @@ -0,0 +1 @@ +50 fakeraid_flag Index: partman/partman-dmraid/choose_partition/dmraid/do_option =================================================================== --- partman/partman-dmraid/choose_partition/dmraid/do_option (revision 0) +++ partman/partman-dmraid/choose_partition/dmraid/do_option (revision 0) @@ -0,0 +1,88 @@ +#!/bin/sh + +. /lib/partman/definitions.sh + +# TODO: Add error checking and error messages !!!!!!!!!!!! + +create_ext2 () { + frpart=${1##*/} + db_subst partman-dmraid/progress/createfs/info DEVICE $frpart + db_progress INFO partman-dmraid/progress/createfs/info + # TODO: check that ext2 is actually available + log-output -t partman-dmraid mkfs.ext2 -q $1 +} + +# Save status (including size) of current dmraid partitions +DM_STATUS="$(dmsetup status --target linear)" + +# If a fake raid partition is in use as swap, it cannot be removed +disable_swap + +# Remove existing fake raid partition devices +# TODO: should probably umount partitions if device is in use +for frdisk in $(dmraid -s -c | grep -v "No RAID disks"); do + for frpart in $(ls /dev/mapper/$frdisk* 2>/dev/null); do + [ $frpart != /dev/mapper/$frdisk ] || continue + + # Remove pending actions on the partitions + devdir=$DEVICES/$(echo $frpart | sed 's:/:=:g') + if [ -d $devdir ]; then + rm -f $devdir/*/method + rm -f $devdir/*/format + fi + + # Remove the device mapper node + dmsetup remove $frpart || exit 1 + done +done + +# Commit the changes +confirm_changes "partman-dmraid" || exit 0 +for s in /lib/partman/commit.d/*; do + if [ -x $s ]; then + $s || { + db_input critical partman-dmraid/commit_failed || true + db_go || true + for s in /lib/partman/init.d/*; do + if [ -x $s ]; then + $s || exit 255 + fi + done + exit 0 + } + fi +done + +# Refresh dmraid partition info +log-output -t partman-dmraid dmraid -ay + +# Use number of linear devices as approximation of steps +PB_MAX=$(dmsetup status --target linear | wc -l) +db_progress START 0 $PB_MAX partman-dmraid/progress/createfs/title + +# Create an initial filesystem so new partitions are detected properly +# HACKALERT: we assume that the size of the device is a sufficient indicator +# that a partition was changed +for frdisk in $(dmraid -s -c | grep -v "No RAID disks"); do + for frpart in $(ls /dev/mapper/$frdisk* 2>/dev/null); do + [ $frpart != /dev/mapper/$frdisk ] || continue + if oldstatus=$(echo $DM_STATUS | grep "^$frpart:"); then + oldsize=$(echo $oldstatus | cut -d" " -f 3) + newsize=$(dmsetup status $frpart | cut -d" " -f 3) + if [ $newsize -ne $oldsize ]; then + create_ext2 $frpart + fi + else + create_ext2 $frpart + fi + db_progress STEP 1 + done +done +db_progress SET $PB_MAX +db_progress STOP + +stop_parted_server + +restart_partman + +exit 0 Property changes on: partman/partman-dmraid/choose_partition/dmraid/do_option ___________________________________________________________________ Name: svn:executable + * Index: partman/partman-dmraid/choose_partition/dmraid/choices =================================================================== --- partman/partman-dmraid/choose_partition/dmraid/choices (revision 0) +++ partman/partman-dmraid/choose_partition/dmraid/choices (revision 0) @@ -0,0 +1,15 @@ +#!/bin/sh + +. /lib/partman/definitions.sh + +dev=$1 +id=$2 + +cd $dev + +type dmraid >/dev/null 2>&1 || exit 0 +[ "$(dmraid -s -c | grep -v "No RAID disks")" ] || exit 0 + +db_metaget partman-dmraid/text/commit_dmraid description + +printf "dmraid\t${RET}\n" Property changes on: partman/partman-dmraid/choose_partition/dmraid/choices ___________________________________________________________________ Name: svn:executable + * Index: partman/partman-dmraid/choose_partition/_numbers =================================================================== --- partman/partman-dmraid/choose_partition/_numbers (revision 0) +++ partman/partman-dmraid/choose_partition/_numbers (revision 0) @@ -0,0 +1 @@ +10 dmraid
Index: partman/partman-base/debian/changelog
===================================================================
--- partman/partman-base/debian/changelog (revision 47287)
+++ partman/partman-base/debian/changelog (working copy)
@@ -1,14 +1,17 @@
partman-base (109) UNRELEASED; urgency=low
[ Otavio Salvador ]
- * Remove partmap on clean
- * Fix a compilation warning on partmap.c
+ * Remove partmap on clean.
+ * Fix a compilation warning on partmap.c.
[ Colin Watson ]
* Use MS-DOS label by default on PS3 systems.
- -- Otavio Salvador <[EMAIL PROTECTED]> Tue, 22 May 2007 13:45:01 -0300
+ [ Frans Pop ]
+ * Add support for fake (ata) RAID.
+ -- Frans Pop <[EMAIL PROTECTED]> Thu, 14 Jun 2007 23:16:59 +0200
+
partman-base (108) unstable; urgency=low
[ Martin Michlmayr ]
Index: partman/partman-base/debian/partman-base.templates
===================================================================
--- partman/partman-base/debian/partman-base.templates (revision 47287)
+++ partman/partman-base/debian/partman-base.templates (working copy)
@@ -285,6 +285,14 @@
Type: text
_Description: Encrypted volume (%s)
+Template: partman/text/dmraid_volume
+Type: text
+Description: Fake (ata) RAID %s (%s)
+
+Template: partman/text/dmraid_part
+Type: text
+Description: Fake (ata) RAID %s (partition #%s)
+
Template: partman/text/lvm_lv
Type: text
_Description: LVM VG %s, LV %s
Index: partman/partman-base/definitions.sh
===================================================================
--- partman/partman-base/definitions.sh (revision 47287)
+++ partman/partman-base/definitions.sh (working copy)
@@ -709,13 +709,37 @@
printf "$RET" ${type} ${device}
;;
/dev/mapper/*)
- # First of all, check if this is a dm-crypt device
type=""
if [ -x /sbin/dmsetup ]; then
type=$(/sbin/dmsetup table "$1" | head -n 1 | cut -d " " -f3)
fi
- if [ "$type" = crypt ]; then
+ # First check for fake (ata) RAID devices
+ if type dmraid >/dev/null 2>&1; then
+ for frdisk in $(dmraid -s -c | grep -v "No RAID disks"); do
+ device=${1#/dev/mapper/}
+ case "$1" in
+ /dev/mapper/$frdisk)
+ type=fakeraid
+ superset=${device%_*}
+ desc=$(dmraid -s -c -c "$superset")
+ rtype=$(echo "$desc" | cut -d: -f4)
+ db_metaget partman/text/dmraid_volume description
+ printf "$RET" $device $rtype
+ ;;
+ /dev/mapper/$frdisk*)
+ type=fakeraid
+ part=${device#$frdisk}
+ db_metaget partman/text/dmraid_part description
+ printf "$RET" $device $part
+ ;;
+ esac
+ done
+ fi
+
+ if [ "$type" = fakeraid ]; then
+ :
+ elif [ "$type" = crypt ]; then
mapping=${1#/dev/mapper/}
db_metaget partman/text/dmcrypt_volume description
printf "$RET" $mapping
@@ -1130,6 +1154,10 @@
if [ "$formatted_previously" = no ]; then
db_input critical $template/confirm_nochanges
db_go || true
+ if [ $template = partman-dmraid ]; then
+ # for dmraid, only a note is displayed
+ return 1
+ fi
db_get $template/confirm_nochanges
if [ "$RET" = false ]; then
db_reset $template/confirm_nochanges
Index: partman/partman-base/init.d/parted
===================================================================
--- partman/partman-base/init.d/parted (revision 47287)
+++ partman/partman-base/init.d/parted (working copy)
@@ -4,6 +4,18 @@
. /lib/partman/definitions.sh
+ORIG_IFS="$IFS"
+
+part_of_fakeraid () {
+ local raiddev
+ for raiddev in $(dmraid -r -c); do
+ if [ "$(readlink -f $raiddev)" = $1 ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
if [ ! -f /var/run/parted_server.pid ]; then
[ -d /var/run ] || mkdir /var/run
parted_server
@@ -27,8 +39,18 @@
sed 's,^/dev/\(ide\|scsi\|[hs]d\),!/dev/\1,' |
sort |
sed 's,^!,,' ); do
+
IFS="$TAB"
set -- $partdev
+ IFS="$ORIG_IFS"
+
+ # Skip devices that are part of a dmraid device
+ if type dmraid >/dev/null 2>&1; then
+ if part_of_fakeraid $partdev; then
+ continue
+ fi
+ fi
+
dirname=$(echo $1 | sed 's:/:=:g')
dev=$DEVICES/$dirname
if [ -d /var/lib/partman/old_devices/$dirname ]; then
Index: partman/partman-basicfilesystems/debian/changelog
===================================================================
--- partman/partman-basicfilesystems/debian/changelog (revision 47287)
+++ partman/partman-basicfilesystems/debian/changelog (working copy)
@@ -2,6 +2,7 @@
* Move deletion of SVN directories to install-rc script.
* Improve the way install-rc is called.
+ * Don't autouse swap a partition if the parent device is fake (ata) RAID.
-- Frans Pop <[EMAIL PROTECTED]> Sun, 13 May 2007 04:05:49 +0200
Index: partman/partman-basicfilesystems/init.d/autouse_swap
===================================================================
--- partman/partman-basicfilesystems/init.d/autouse_swap (revision 47287)
+++ partman/partman-basicfilesystems/init.d/autouse_swap (working copy)
@@ -8,6 +8,9 @@
for dev in /var/lib/partman/devices/*; do
[ -d "$dev" ] || continue
+ # Skip dmraid partitions
+ [ ! -e "$dev/fakeraid" ] || continue
+
# Only run the first time each device is encountered.
devbase="$(basename "$dev")"
[ ! -f "/var/lib/partman/autoused_swap/$devbase" ] || continue
Index: partman/partman-partitioning/debian/changelog
===================================================================
--- partman/partman-partitioning/debian/changelog (revision 47287)
+++ partman/partman-partitioning/debian/changelog (working copy)
@@ -1,3 +1,9 @@
+partman-partitioning (51) UNRELEASED; urgency=low
+
+ * When creating a partition on a fake (ata) RAID device, do not use it.
+
+ -- Frans Pop <[EMAIL PROTECTED]> Fri, 15 Jun 2007 18:24:16 +0200
+
partman-partitioning (50) unstable; urgency=low
[ Colin Watson ]
Index: partman/partman-partitioning/free_space/new/do_option
===================================================================
--- partman/partman-partitioning/free_space/new/do_option (revision 47287)
+++ partman/partman-partitioning/free_space/new/do_option (working copy)
@@ -143,7 +143,10 @@
db_progress START 0 $numparts partman/text/please_wait
db_progress INFO partman-partitioning/new_state
- if [ -n "$id" -a -f ../../ext3 ]; then
+ # Fake raid partitions cannot be used directly under the parent device
+ if [ -f fakeraid ]; then
+ :
+ elif [ -n "$id" -a -f ../../ext3 ]; then
# make better defaults for the new partition
[ -d $id ] || mkdir $id
echo format >$id/method
Index: partman/partman-target/debian/changelog
===================================================================
--- partman/partman-target/debian/changelog (revision 47287)
+++ partman/partman-target/debian/changelog (working copy)
@@ -2,6 +2,7 @@
* Move deletion of SVN directories to install-rc script.
* Improve the way install-rc is called.
+ * Do not offer to set method for a fake (ata) RAID device.
-- Frans Pop <[EMAIL PROTECTED]> Sun, 13 May 2007 04:04:58 +0200
Index: partman/partman-target/active_partition/method/choices
===================================================================
--- partman/partman-target/active_partition/method/choices (revision 47287)
+++ partman/partman-target/active_partition/method/choices (working copy)
@@ -6,6 +6,8 @@
id=$2
cd $dev
+[ ! -f fakeraid ] || exit 0
+
if [ -f $id/method ]; then
method=$(cat $id/method)
else
pgpvHaGWOb37w.pgp
Description: PGP signature

