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

ext4 support



I've been working on adding ext4 support to d-i for Ubuntu. It's
dependent on the following bugs external to d-i:

e2fsprogs:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511207
  (missing mkfs.ext4 symlink in e2fsprogs-udeb)

grub:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511121
  (I understand that grub2 also supports ext4, but applying the patch
  above would decouple ext4 support from the grub2 transition.)

klibc:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510758
  (fstype fails to detect ext4)

parted:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511224
  (fairly basic support but enough to get the job done)

I've attached the necessary d-i patches (against current Ubuntu, but
I'll do any necessary work to merge into Debian) to this mail. As you'll
see, I decided to tweak partman-ext3 rather than create a new
partman-ext4 component: I don't think the differences between ext3 and
ext4 from the installer point of view justify a whole new udeb.

Given that we won't be looking at d-i uploads aimed at Squeeze for a
while anyway, I'd expect there to be plenty of time to get the patches
above applied (and if they aren't then NMUs would probably not be out of
order). Thus, unless anyone objects, I propose to go ahead and apply the
attached patch to trunk soon in order to make it easier for interested
people to experiment.

Comments?

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
Index: packages/partman/partman-auto/lib/recipes.sh
===================================================================
--- packages/partman/partman-auto/lib/recipes.sh	(revision 57133)
+++ packages/partman/partman-auto/lib/recipes.sh	(working copy)
@@ -80,7 +80,7 @@
 				max=$min
 			fi
 			case "$4" in # allow only valid file systems
-			    ext2|ext3|xfs|reiserfs|jfs|linux-swap|fat16|fat32|hfs)
+			    ext2|ext3|ext4|xfs|reiserfs|jfs|linux-swap|fat16|fat32|hfs)
 				fs="$4"
 				;;
 			    *)
@@ -336,7 +336,7 @@
 		max=$3
 		fs=$4
 		case "$fs" in
-		    ext2|ext3|linux-swap|fat16|fat32|hfs)
+		    ext2|ext3|ext4|linux-swap|fat16|fat32|hfs)
 			true
 			;;
 		    *)
Index: packages/partman/partman-ext3/check.d/nomountpoint_ext3
===================================================================
--- packages/partman/partman-ext3/check.d/nomountpoint_ext3	(revision 57133)
+++ packages/partman/partman-ext3/check.d/nomountpoint_ext3	(working copy)
@@ -20,8 +20,11 @@
 		[ -f $id/acting_filesystem ] || continue
 		filesystem=$(cat $id/acting_filesystem)
 		case "$filesystem" in
-		    ext3)
+		    ext3|ext4)
 			[ ! -f "$id/mountpoint" ] || continue
+			RET=''
+			db_metaget partman/filesystem_short/"$filesystem" description || RET=''
+			[ "$RET" ] || RET="$filesystem"
 			db_subst partman-ext3/no_mount_point PARTITION "$num"
 			db_subst partman-ext3/no_mount_point FILESYSTEM "$filesystem"
 			db_subst partman-ext3/no_mount_point DEVICE $(humandev $(cat device))
Index: packages/partman/partman-ext3/fstab.d/ext3
===================================================================
--- packages/partman/partman-ext3/fstab.d/ext3	(revision 57133)
+++ packages/partman/partman-ext3/fstab.d/ext3	(working copy)
@@ -13,7 +13,7 @@
 		method=$(cat $id/method)
 		filesystem=$(cat $id/acting_filesystem)
 		case "$filesystem" in
-		    ext3)
+		    ext3|ext4)
 			[ -f "$id/mountpoint" ] || continue
 			mountpoint=$(cat $id/mountpoint)
 			# due to #249322, #255135, #258117:
@@ -31,7 +31,7 @@
 			else
 				pass=2
 			fi
-			echo "$path" "$mountpoint" ext3 $options 0 $pass
+			echo "$path" "$mountpoint" $filesystem $options 0 $pass
 			;;
 		esac
 	done
Index: packages/partman/partman-ext3/finish.d/aptinstall_ext3
===================================================================
--- packages/partman/partman-ext3/finish.d/aptinstall_ext3	(revision 57133)
+++ packages/partman/partman-ext3/finish.d/aptinstall_ext3	(working copy)
@@ -14,7 +14,7 @@
 		[ -f $id/method -a -f $id/acting_filesystem ] || continue
 		filesystem=$(cat $id/acting_filesystem)
 		case $filesystem in
-		    ext3)
+		    ext3|ext4)
 			ext3=yes
 			;;
 		esac
Index: packages/partman/partman-ext3/debian/partman-ext3.templates
===================================================================
--- packages/partman/partman-ext3/debian/partman-ext3.templates	(revision 57133)
+++ packages/partman/partman-ext3/debian/partman-ext3.templates	(working copy)
@@ -1,13 +1,13 @@
 Template: partman-ext3/progress_checking
 Type: text
 # :sl1:
-_Description: Checking the ext3 file system in partition #${PARTITION} of ${DEVICE}...
+_Description: Checking the ${TYPE} file system in partition #${PARTITION} of ${DEVICE}...
 
 Template: partman-ext3/check_failed
 Type: boolean
 # :sl2:
 _Description: Go back to the menu and correct errors?
- The test of the file system with type ext3 in partition #${PARTITION}
+ The test of the file system with type ${TYPE} in partition #${PARTITION}
  of ${DEVICE} found uncorrected errors.
  .
  If you do not go back to the partitioning menu and correct these errors,
@@ -17,14 +17,14 @@
 Type: error
 # :sl2:
 _Description: Failed to create a file system
- The ext3 file system creation in partition
+ The ${TYPE} file system creation in partition
  #${PARTITION} of ${DEVICE} failed.
 
 Template: partman-ext3/no_mount_point
 Type: boolean
 # :sl2:
 _Description: Do you want to return to the partitioning menu?
- No mount point is assigned for the ext3 file system in partition
+ No mount point is assigned for the ${FILESYSTEM} file system in partition
  #${PARTITION} of ${DEVICE}.
  .
  If you do not go back to the partitioning menu and assign a mount point
@@ -54,6 +54,24 @@
 # Short file system name (untranslatable in many languages)
 _Description: ext3
 
+Template: partman-ext3/text/ext4
+Type: text
+# :sl1:
+# File system name (untranslatable in many languages)
+_Description: ext4
+
+Template: partman/filesystem_long/ext4
+Type: text
+# :sl2:
+# File system name
+_Description: Ext4 journaling file system
+
+Template: partman/filesystem_short/ext4
+Type: text
+# :sl1:
+# Short file system name (untranslatable in many languages)
+_Description: ext4
+
 Template: partman-ext3/boot_not_ext2_or_ext3
 Type: boolean
 # :sl2:
Index: packages/partman/partman-ext3/parted_names/ext4
===================================================================
--- packages/partman/partman-ext3/parted_names/ext4	(revision 0)
+++ packages/partman/partman-ext3/parted_names/ext4	(revision 0)
@@ -0,0 +1 @@
+ext4
Index: packages/partman/partman-ext3/mount.d/ext3
===================================================================
--- packages/partman/partman-ext3/mount.d/ext3	(revision 57133)
+++ packages/partman/partman-ext3/mount.d/ext3	(working copy)
@@ -10,8 +10,8 @@
 pass=$6
 
 case $type in
-    ext3)
-	mount -t ext3 ${options:+-o "$options"} $fs /target$mp || exit 1
+    ext3|ext4)
+	mount -t $type ${options:+-o "$options"} $fs /target$mp || exit 1
 	echo "umount /target$mp"
 	exit 0
 	;;
Index: packages/partman/partman-ext3/active_partition/ext3/choices
===================================================================
--- packages/partman/partman-ext3/active_partition/ext3/choices	(revision 57133)
+++ packages/partman/partman-ext3/active_partition/ext3/choices	(working copy)
@@ -15,7 +15,7 @@
 filesystem=$(cat $part/acting_filesystem)
 
 case "$filesystem" in
-    ext3)
+    ext3|ext4)
 	:
 	;;
     *)
@@ -46,7 +46,7 @@
 	  -o $part/formatted -ot $part/method \
 	  -o $part/formatted -ot $part/filesystem ] || return 0
 	case "$filesystem" in
-	    ext3)
+	    ext3|ext4)
 		if [ -f $part/label ]; then
 			label=$(cat $part/label)
 		else
Index: packages/partman/partman-ext3/init.d/kernelmodules_ext3
===================================================================
--- packages/partman/partman-ext3/init.d/kernelmodules_ext3	(revision 57133)
+++ packages/partman/partman-ext3/init.d/kernelmodules_ext3	(working copy)
@@ -6,15 +6,28 @@
 while read module_name x; do
 	if [ "$module_name" = ext3 ]; then
 		>/var/lib/partman/ext3
-		exit 0
 	fi
+	if [ "$module_name" = ext4 ]; then
+		>/var/lib/partman/ext4
+	fi
 done
 
-if modprobe ext3 >/dev/null 2>/dev/null; then
+if ! [ -f /var/lib/partman/ext3 ] && \
+   modprobe ext3 >/dev/null 2>/dev/null; then
 	>/var/lib/partman/ext3
-	exit 0
 fi
 
-if grep -q ext3 /proc/filesystems; then
+if ! [ -f /var/lib/partman/ext4 ] && \
+   modprobe ext4 >/dev/null 2>/dev/null; then
+	>/var/lib/partman/ext4
+fi
+
+if ! [ -f /var/lib/partman/ext3 ] && \
+   grep -q ext3 /proc/filesystems; then
 	>/var/lib/partman/ext3
 fi
+
+if ! [ -f /var/lib/partman/ext4 ] && \
+   grep -q ext4 /proc/filesystems; then
+	>/var/lib/partman/ext4
+fi
Index: packages/partman/partman-ext3/valid_filesystems/ext4
===================================================================
--- packages/partman/partman-ext3/valid_filesystems/ext4	(revision 0)
+++ packages/partman/partman-ext3/valid_filesystems/ext4	(revision 0)
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+dev=$1
+id=$2
+property=$3
+
+[ -f /var/lib/partman/ext4 ] || exit 0
+
+case $property in
+    formatable)
+	echo ext4
+	;;
+    existing)
+	[ -f $id/detected_filesystem ] || exit 0
+	fs=$(cat $id/detected_filesystem)
+
+	case "$fs" in
+	    ext4)
+		echo ext4
+		;;
+	esac
+	;;
+esac
+
+
Index: packages/partman/partman-ext3/valid_filesystems/_numbers
===================================================================
--- packages/partman/partman-ext3/valid_filesystems/_numbers	(revision 57133)
+++ packages/partman/partman-ext3/valid_filesystems/_numbers	(working copy)
@@ -1 +1,2 @@
 05 ext3
+06 ext4
Index: packages/partman/partman-ext3/commit.d/format_ext3
===================================================================
--- packages/partman/partman-ext3/commit.d/format_ext3	(revision 57133)
+++ packages/partman/partman-ext3/commit.d/format_ext3	(working copy)
@@ -22,7 +22,7 @@
 		  -a -f $id/acting_filesystem ] || continue
 		filesystem=$(cat $id/acting_filesystem)
 		case $filesystem in
-		    ext3)
+		    ext3|ext4)
 			if [ -f $id/formatted ] && \
 			   [ $id/formatted -nt $id/method ] && \
 			   ([ ! -f $id/filesystem ] || \
@@ -41,8 +41,8 @@
 			close_dialog
 
 			RET=''
-			db_metaget partman/filesystem_short/ext3 description || RET=''
-			[ "$RET" ] || RET=ext3
+			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))
@@ -77,7 +77,7 @@
 					usage=''
 				fi
 				if log-output -t partman --pass-stdout \
-				   mkfs.ext3 $device $usage >/dev/null; then
+				   mkfs.$filesystem $device $usage >/dev/null; then
 					sync
 					status=OK
 				else
@@ -101,6 +101,10 @@
 				fi
 			fi
 			if [ "$status" != OK ]; then
+				RET=''
+				db_metaget partman/filesystem_short/"$filesystem" description || RET=''
+				[ "$RET" ] || RET="$filesystem"
+				db_subst partman-ext3/create_failed TYPE "$RET"
 				db_subst partman-ext3/create_failed PARTITION "$num"
 				db_subst partman-ext3/create_failed DEVICE $(humandev $(cat device))
 				db_input critical partman-ext3/create_failed || true
Index: packages/partman/partman-ext3/mountoptions/ext4
===================================================================
--- packages/partman/partman-ext3/mountoptions/ext4	(revision 0)
+++ packages/partman/partman-ext3/mountoptions/ext4	(revision 0)
@@ -0,0 +1,10 @@
+noatime
+relatime
+nodev
+nosuid
+noexec
+ro
+sync
+usrquota
+grpquota
+user_xattr
Index: packages/partman/partman-partitioning/active_partition/resize/do_option
===================================================================
--- packages/partman/partman-partitioning/active_partition/resize/do_option	(revision 57133)
+++ packages/partman/partman-partitioning/active_partition/resize/do_option	(working copy)
@@ -18,7 +18,7 @@
 			exit 1
 		fi
 		;;
-	    ext2|ext3)
+	    ext2|ext3|ext4)
 		if ! get_ext2_resize_range; then
 			db_input critical partman-partitioning/impossible_resize || true
 			db_go || true
Index: packages/partman/partman-partitioning/active_partition/resize/choices
===================================================================
--- packages/partman/partman-partitioning/active_partition/resize/choices	(revision 57133)
+++ packages/partman/partman-partitioning/active_partition/resize/choices	(working copy)
@@ -20,7 +20,7 @@
 	case "$fs" in
 	    linux-swap|fat16|fat32|hfs|hfs+|hfsx)
 		;;
-	    ext2|ext3)
+	    ext2|ext3|ext4)
 		if ! search-path tune2fs || ! search-path resize2fs; then
 			exit 0
 		fi
Index: packages/partman/partman-partitioning/lib/resize.sh
===================================================================
--- packages/partman/partman-partitioning/lib/resize.sh	(revision 57133)
+++ packages/partman/partman-partitioning/lib/resize.sh	(working copy)
@@ -224,9 +224,10 @@
 	elif [ "$virtual" = no ] && \
 	     [ -f $oldid/detected_filesystem ] && \
 	     ([ "$(cat $oldid/detected_filesystem)" = ext2 ] || \
-	      [ "$(cat $oldid/detected_filesystem)" = ext3 ]); then
+	      [ "$(cat $oldid/detected_filesystem)" = ext3 ] || \
+	      [ "$(cat $oldid/detected_filesystem)" = ext4 ]); then
 
-		# Resize ext2/ext3; parted can handle simple cases but can't deal
+		# Resize ext2/ext3/ext4; parted can handle simple cases but can't deal
 		# with certain common features such as resize_inode
 		fs="$(cat $oldid/detected_filesystem)"
 		db_progress START 0 1000 partman/text/please_wait
@@ -279,7 +280,7 @@
 		db_progress SET 500
 		if longint_le "$cursize" "$newsize"; then
 			if ! resize2fs $path; then
-				logger -t partman "Error resizing the ext2/ext3 file system to the partition size"
+				logger -t partman "Error resizing the ext2/ext3/ext4 file system to the partition size"
 				db_input high partman-partitioning/new_size_commit_failed || true
 				db_go || true
 				db_progress STOP
@@ -294,14 +295,14 @@
 				update-dev
 
 				if ! resize2fs $path; then
-					logger -t partman "Error resizing the ext2/ext3 file system to the partition size"
+					logger -t partman "Error resizing the ext2/ext3/ext4 file system to the partition size"
 					db_input high partman-partitioning/new_size_commit_failed || true
 					db_go || true
 					db_progress STOP
 					exit 100
 				fi
 			else
-				logger -t partman "Error resizing the ext2/ext3 file system"
+				logger -t partman "Error resizing the ext2/ext3/ext4 file system"
 				db_input high partman-partitioning/new_size_commit_failed || true
 				db_go || true
 				db_progress STOP
@@ -313,7 +314,7 @@
 
 	else
 
-		# Resize virtual partitions, ext2, ext3, swap, fat16, fat32
+		# Resize virtual partitions, ext2, ext3, ext4, swap, fat16, fat32
 		# and probably reiserfs
 		name_progress_bar partman-partitioning/progress_resizing
 		open_dialog RESIZE_PARTITION $oldid $newsize

Reply to: