[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#389881: RC-ness of this bug



On Wed, Mar 07, 2007 at 03:18:19PM +0100, David Härdeman wrote:
On Wed, March 7, 2007 13:55, Otavio Salvador said:
I don't know how invasive those changes might be. AFAIK Ubuntu already
does it (Colin?) and wouldn't be too hard to pick the changes from
them but we would also need RM and Frans approval :(

initramfs-tools already supports using /dev/disk/by-* entries in fstab. As
for the installer, I'm not sure that looking at Ubuntu will help since
they use something different than d-i for the regular installs (and I
don't know if their d-i based installer has any
mount-by-label/uuid/whatever fixes).

It would be pretty simple to implement as a late_command script though,
quick pseudo-code:
...

I've attached a patch which implements persistent device names in partman by checking for devices which are mounted under /target and which have a suitable link in /dev/disk/by-id/*

For each device that is found, /target/etc/fstab is modified appropriately.

I've done one test install using the patch and it sucessfully changed /dev/sda1 to /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001-part1 in /target/etc/fstab, it's currenlty busy installing the base system.

I believe this patch would fix #225802, #295134, #308565, #389881

--
David Härdeman

Index: debian/changelog
===================================================================
--- debian/changelog	(revision 45633)
+++ debian/changelog	(working copy)
@@ -1,3 +1,10 @@
+partman-target (49) UNRELEASED; urgency=low
+
+  * Add script to use persistent device nodes in /etc/fstab where
+    possible
+
+ -- David Härdeman <david@hardeman.nu>  Thu,  8 Mar 2007 00:17:24 +0100
+
 partman-target (48) unstable; urgency=low
 
   [ Updated translations ]
Index: finish.d/fstab_persistent
===================================================================
--- finish.d/fstab_persistent	(revision 0)
+++ finish.d/fstab_persistent	(revision 0)
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+[ -f /target/etc/fstab ] || exit 0
+fstab=$(
+	cat /target/etc/fstab |
+	while read line; do
+		# Make sure this is a proper entry
+		if echo "$line" | grep -q "^[[:space:]]*$\|^#"; then
+			echo "$line"
+			continue
+		fi
+
+		# Parse entry
+		echo -n "$line" > /tmp/partman-target
+		read fs mp type options dump pass < /tmp/partman-target
+		rm -f /tmp/partman-target
+
+		# Ignore devices not mounted under /target
+		if [ "$mp" = "/" ]; then
+			tmpmp="/target"
+		else
+			tmpmp="/target$mp"
+		fi
+		if ! grep -q " $tmpmp " /proc/mounts; then
+			echo "$line"
+			continue
+		fi
+
+		# See if we can find a persistent device name
+		for link in /dev/disk/by-id/*; do
+			linktarget=$(mapdevfs $(readlink -f "$link"))
+			if [ "$linktarget" = "$fs" ]; then
+				break
+			fi
+			linktarget=
+		done
+		if [ -z "$linktarget" ]; then
+			echo "$line"
+			continue
+		fi
+
+		printf "%-15s %-15s %-7s %-15s %-7s %s\n" "${link}" "${mp}" "$type" "$options" "$dump" "$pass"
+	done
+)
+
+echo "$fstab" > /target/etc/fstab
+exit 0

Property changes on: finish.d/fstab_persistent
___________________________________________________________________
Name: svn:executable
   + *

Index: finish.d/_numbers
===================================================================
--- finish.d/_numbers	(revision 45633)
+++ finish.d/_numbers	(working copy)
@@ -4,3 +4,4 @@
 40 fstab_hd_entries
 50 fstab_removable_media_entries
 95 reformat_after_restart
+98 fstab_persistent


Reply to: