*New 11.3 series Release:
2019-10-19: XigmaNAS 11.3.0.4.7014 - released

*New 12.0 series Release:
2019-10-05: XigmaNAS 12.0.0.4.6928 - released!

*New 11.2 series Release:
2019-09-23: XigmaNAS 11.2.0.4.6881 - released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

Boot from slice != 1

Compile and development by yourself!
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
svily0
Starter
Starter
Posts: 29
Joined: 03 Apr 2013 12:05
Status: Offline

Boot from slice != 1

#1

Post by svily0 » 05 Jul 2015 19:14

Hello, I'm getting an error while trying to boot embedded Nas4Free installed in da0s2a. Error message states that Config.xml can't be found on the boot device, then the server halts. What is the correct way to force the system to consider slice 2 as a viable boot option?

Okay, I've found the relevant code in /etc/inc/config.inc
Still unsure how to approach the issue though, PHP is not my cup of tea.

Regards

svily0
Starter
Starter
Posts: 29
Joined: 03 Apr 2013 12:05
Status: Offline

Re: Boot from slice != 1

#2

Post by svily0 » 08 Jul 2015 12:41

The patch below does what I need...

Code: Select all

--- a/config.inc	2015-06-19 23:00:56.000000000 +0300
+++ b/config.inc	2015-07-07 19:15:33.981852035 +0300
@@ -122,15 +122,25 @@
 				echo " {$disk}";
 
 				// Try to mount device using UFS
-				if (0 == mwexec("/sbin/mount -r /dev/{$disk}s1a {$g['cf_path']}")) { // Search on slice 1
+
+				// Loop over disk's BSD <a> partitions
+				foreach (explode(" ", exec("/bin/ls /dev/{$disk}s?a")) as $pt) {
+				    if (0 == mwexec("/sbin/mount -r {$pt} {$g['cf_path']}")) { // Search on a <a> partition
 					if (file_exists("{$g['cf_conf_path']}/config.xml")) {
-						$cfgdevice = $disk;
-						$cfgpartition = "{$cfgdevice}s1a";
-						$cfgfstype = "ufs";
+					    $cfgdevice = $disk;
+					    $cfgpartition = trim(preg_replace("#/dev/#", "", $pt));
+					    $cfgfstype = "ufs";
 					}
 					// Unmount device
 					mwexec("/sbin/umount -f {$g['cf_path']}");
-				} else if (0 == mwexec("/sbin/mount -r /dev/{$disk}p2 {$g['cf_path']}")) { // Search on GPT/p2
+				    }
+				    // Device found, exit
+				    if ($cfgdevice) {
+					break 2;
+				    }
+				}
+
+				if (0 == mwexec("/sbin/mount -r /dev/{$disk}p2 {$g['cf_path']}")) { // Search on GPT/p2
 					if (file_exists("{$g['cf_conf_path']}/config.xml")) {
 						$cfgdevice = $disk;
 						$cfgpartition = "{$cfgdevice}p2";

Post Reply

Return to “Development & Developers”