Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Oct 2002 01:39:37 -0500
From:      John De Boskey <jwd@freebsd.org>
To:        Current List <freebsd-current@freebsd.org>
Subject:   Large 'label'ing defaults for sysinstall
Message-ID:  <20021028063937.GA37379@BSDWins.Com>

next in thread | raw e-mail | index | archive | help
Hi,

   In this day of larger disk drives, I've modified
the code in sysinstall to automatically create a /home
partition and increase the rest of the sizes if the
size of the disk (or slice) exceeds a given size (currently
58gig in my patch). For example, using A(uto in the label
editor on a 100gig drive now gives:

Disk: ad6       Partition name: ad6s1   Free: 0 blocks (0MB)

Part      Mount          Size Newfs   Part      Mount          Size Newfs
----      -----          ---- -----   ----      -----          ---- -----
ad6s1a    /            1024MB UFS   Y
ad6s1b    swap         4096MB SWAP
ad6s1e    /var         4096MB UFS+S Y
ad6s1f    /tmp         8192MB UFS+S Y
ad6s1g    /usr        15360MB UFS+S Y
ad6s1h    /home       62625MB UFS+S Y


   The patch is below. I left the one 'if (large)' condition to
the very left to show indention while attempting to reduce whitespace
diffs. A whitespace only diff can be committed posthumously.

   I'd like to commit this if there are no major objections. The
values of the LARGE defines, will I'm sure, be refined with use :-)

-John

The patch can also be found at:

http://people.freebsd.org/~jwd/sysinstall/label.diff


--- label.c.orig	Mon Oct 28 05:34:00 2002
+++ label.c	Mon Oct 28 06:36:44 2002
@@ -80,11 +80,12 @@
  * for this configuration we scale things relative to the NOM vs DEFAULT
  * sizes.  If the disk is larger then /home will get any remaining space.
  */
-#define ROOT_DEFAULT_SIZE		128
-#define USR_DEFAULT_SIZE		3072
-#define VAR_DEFAULT_SIZE		256
-#define TMP_DEFAULT_SIZE		256
-#define HOME_DEFAULT_SIZE		USR_DEFAULT_SIZE
+#define ROOT_DEFAULT_SIZE		(large ? ROOT_LARGE_SIZE :  128)
+#define SWAP_DEFAULT_SIZE		(large ? SWAP_LARGE_SIZE :    0)
+#define USR_DEFAULT_SIZE		(large ? USR_LARGE_SIZE  : 3072)
+#define VAR_DEFAULT_SIZE		(large ? VAR_LARGE_SIZE  :  256)
+#define TMP_DEFAULT_SIZE		(large ? TMP_LARGE_SIZE  :  256)
+#define HOME_DEFAULT_SIZE		(large ? HOME_LARGE_SIZE : USR_DEFAULT_SIZE)
 
 /*
  * Nominal partition sizes.  These are used to scale the default sizes down
@@ -97,6 +98,23 @@
 #define TMP_NOMINAL_SIZE		64
 #define HOME_NOMINAL_SIZE		USR_NOMINAL_SIZE
 
+/*
+ * Large partition sizes.  If we have a 'large' disk (60gig?) then we
+ * try to scale things up a bit.. In this case, we create the /home
+ * mount point.
+ */
+#define ROOT_LARGE_SIZE			(   1024)
+#define SWAP_LARGE_SIZE			( 4*1024)
+#define USR_LARGE_SIZE			(15*1024)
+#define VAR_LARGE_SIZE			( 4*1024)
+#define TMP_LARGE_SIZE			( 8*1024)
+#define HOME_LARGE_SIZE			(17*1024)
+
+/*
+ * Let's define a what we think a large disk is..
+ */
+#define LARGE_DISK_SIZE			(58*1024*1024)
+
 /* The bottom-most row we're allowed to scribble on */
 #define CHUNK_ROW_MAX			16
 
@@ -1178,6 +1196,7 @@
 try_auto_label(Device **devs, Device *dev, int perc, int *req)
 {
     int sz;
+    int large = 0;
     struct chunk *root_chunk = NULL;
     struct chunk *swap_chunk = NULL;
     struct chunk *usr_chunk = NULL;
@@ -1192,6 +1211,11 @@
     char *msg = NULL;
 
     sz = space_free(label_chunk_info[here].c);
+    if (sz > LARGE_DISK_SIZE)
+	large = 1;
+    else
+	large = 0; /* Just in case */
+
     if (sz <= FS_MIN_SIZE)
 	return("Not enough free space to create a new partition in the slice");
 
@@ -1214,7 +1238,7 @@
 	record_label_chunks(devs, dev);
     }
     if (!swapdev) {
-	sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc);
+	sz = requested_part_size(VAR_SWAP_SIZE, 0, SWAP_DEFAULT_SIZE, perc);
 	if (sz == 0) {
 	    int nom;
 	    int def;
@@ -1279,9 +1303,9 @@
     }
     if (!usrdev && !variable_get(VAR_NO_USR)) {
 	sz = requested_part_size(VAR_USR_SIZE, USR_NOMINAL_SIZE, USR_DEFAULT_SIZE, perc);
-#if AUTO_HOME == 0
+        if (!large)
 	    sz = space_free(label_chunk_info[here].c);
-#endif
+
 	if (sz) {
 	    if (sz < (USR_MIN_SIZE * ONE_MEG)) {
 		*req = 1;
@@ -1303,7 +1327,7 @@
 	    record_label_chunks(devs, dev);
 	}
     }
-#if AUTO_HOME == 1
+if (large)
     if (!homedev && !variable_get(VAR_NO_HOME)) {
 	sz = requested_part_size(VAR_HOME_SIZE, HOME_NOMINAL_SIZE, HOME_DEFAULT_SIZE, perc);
 	if (sz < space_free(label_chunk_info[here].c))
@@ -1330,7 +1354,7 @@
 	    record_label_chunks(devs, dev);
 	}
     }
-#endif
+
 
     /* At this point, we're reasonably "labelled" */
     if (variable_cmp(DISK_LABELLED, "written"))

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021028063937.GA37379>