# fstab gaffe!



## FreeDomBSD (Apr 7, 2013)

I made a mistake while following this guide: http://forums.freebsd.org/showthread.php?t=38154
I pointed to a wrong drive for /boot and now got knocked down to single user mode. I can't find the fstab file to edit it.


```
vi /mnt/etc/fstab
```


```
# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/ada0s1a    /mnt/boot               ufs     rw      1       1
```

Instead of ada0s1a I should have specified a USB drive.


Where do I find & how do I edit my fstab?

:q


----------



## zspider (Apr 7, 2013)

Well if you're in single user mode, it mounts root but nothing else and assuming you have the default partitioning scheme, /etc will be on the root partition, the only thing you should have to do is remount the root partition as read write. Then find a way to fix your fstab file, if you can, mount /usr so you can use ee or vi to edit /etc/fstab.


----------



## Beastie (Apr 7, 2013)

Or use /rescue/vi.


----------



## wblock@ (Apr 7, 2013)

This is root on ZFS.  Or rather, root on GELI-encrypted ZFS.  So presumably there is a separate /boot to get the encrypted device created.


----------



## FreeDomBSD (Apr 7, 2013)

wblock@ said:
			
		

> This is root on ZFS.  Or rather, root on GELI-encrypted ZFS.  So presumably there is a separate /boot to get the encrypted device created.



There is a /boot om the USB drive that I'm booting from. I'm having trouble using [CMD=]ee[/CMD] to edit the fstab in /etc/root because it doesn't fully show up on the screen. It tells me that there are 4 lines in it, but I can't see them.


----------



## FreeDomBSD (Apr 7, 2013)

[CMD=]vi[/CMD] also makes a point that this is a read-only file system.


----------



## FreeDomBSD (Apr 7, 2013)

Screenshot.


----------



## wblock@ (Apr 7, 2013)

Remount it read-write:
`# mount -u /`


----------



## FreeDomBSD (Apr 7, 2013)

wblock@ said:
			
		

> Remount it read-write:
> `# mount -u /`





```
mount: not found
```


----------



## wblock@ (Apr 7, 2013)

Yes, that's the problem with having only /boot.  Boot with mfsBSD or into the live CD mode of the installer.


----------



## FreeDomBSD (Apr 7, 2013)

@wblock@, I booted up with mfsBSD (via USB drive). I believe fstab that I need to edit is on the other USB drive that I usually boot from. Is this right? Do I need to mount the root filesystem from the other USB drive? The other USB drive  is da0 in /dev

I tried to mount it with `mount` to no avail.

What am I not doing right?


----------



## wblock@ (Apr 7, 2013)

mfsBSD is memory-based.  Once it has loaded, remove that USB stick and connect the other.  Or leave them both connected, but realize that it may change the device numbers.


----------



## FreeDomBSD (Apr 7, 2013)

Thanks, both USB drives are plugged in. (I should have mentioned that from the start.)



I tried mounting da0 in different ways, but I cant get it to work

```
#cd /mnt && mkdir usb
#mount dev/da0 /mnt/usb
mount: no such file or directory
```
`#camcontrol devlist` lists it as 
	
	



```
< 1.20>             at scbus3 target 0 lun 0 (da0,pass2)
```

`# cd /dev && ls -a` gives me da0-related entries of da0, da0p1, da0p2, and da0p3








I know I'm doing something wrong, but what?


----------



## FreeDomBSD (Apr 8, 2013)

I figured out what I was doing wrong, but when I opened the fstab on da0p2 it was empty. I'm just going to start all over.


----------



## FreeDomBSD (Apr 8, 2013)

After the last post I made a fresh FreeBSD 9.1 install, but unfortunately after yet another try I screwed something up once again:







```
root@z0nder:/ # mkdir -p /mnt/mnt/boot
root@z0nder:/ # ee /mnt/etc/fstab
^[ (escape) menu  ^y search prompt  ^k delete line   ^p prev li   ^g prev page
^o ascii code     ^x search         ^l undelete line ^n next li   ^v next page
^u end of file    ^a begin of line  ^w delete word   ^b back 1 char
^t top of text    ^e end of line    ^r restore word  ^f forward 1 char
^c command        ^d delete                          ^z next word
=====line 3 col 12 lines fr                         ===========================
# Device        Mountpoint      FStype  Options Dump    Pass#

[color="Red"]/dev/da0p1      /mnt/boot       boot    rw      1       1[/color]
/dev/da0p2      /               ufs     rw      1       1
/dev/da0p3      none            swap    sw      0       0












"/mnt/etc/fstab" 5 lines, 159 characters
root@z0nder:/ # ln -s /mnt/boot/boot /mnt/boot
root@z0nder:/ # ee /boot/loader.conf
^[ (escape) menu  ^y search prompt  ^k delete line   ^p prev li   ^g prev page
^o ascii code     ^x search         ^l undelete line ^n next li   ^v next page
^u end of file    ^a begin of line  ^w delete word   ^b back 1 char
^t top of text    ^e end of line    ^r restore word  ^f forward 1 char
^c command        ^d delete                          ^z next word
=====line 3 col 29 lines fr                         ===========================
[color="Green"]geom_eli_load="YES"
zfs_load="YES"
vfs.root.mountfrom="zfs:tank"
[/color]













"/boot/loader.conf" 3 lines, 65 characters
root@z0nder:/ # ee /mnt/etc/rc.conf
^[ (escape) menu  ^y search prompt  ^k delete line   ^p prev li   ^g prev page
^o ascii code     ^x search         ^l undelete line ^n next li   ^v next page
^u end of file    ^a begin of line  ^w delete word   ^b back 1 char
^t top of text    ^e end of line    ^r restore word  ^f forward 1 char
^c command        ^d delete                          ^z next word
=====line 7 col 16 lines fr                         ===========================
hostname="z0nder.mesh"
ifconfig_re0="DHCP"
sshd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
[color="Green"]zfs_enable="YES"[/color]










"/mnt/etc/rc.conf" 7 lines, 174 characters
root@z0nder:/ # cp /mnt/zpool.cache /boot/zfs/zpool.cache
```

I thought I did everything correctly this time in the fstab, but I guess I was wrong.


```
gparted: Command not found.

=>      34  15633341  da0  GPT  (7.5G)
[color="Red"]        34       128    1  freebsd-boot  (64k)[/color]
       162  14847872    2  freebsd-ufs  (7.1G)
  14848034    780288    3  freebsd-swap  (381M)
  15628322      5053       - free -  (2.5M)

root@z0nder:/usr/home/a0943037 # fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=973 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=973 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 238 (0xee),(EFI GPT)
    start 1, size 15633407 (7633 Meg), flag 80 (active)
        beg: cyl 0/ head 0/ sector 2;
        end: cyl 1023/ head 255/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```
I'm following this guide: http://forums.freebsd.org/showthread.php?t=38154

I'm pretty stuck now. Could someone please give me a hint at what is the matter with my setup?


----------



## FreeDomBSD (Apr 13, 2013)

I still haven't managed to solve this. I would appreciate anyone's input on what to try next.


----------



## kpa (Apr 13, 2013)

One thing that jumps right at me is that you're trying to mount the freebsd-boot partition at /mnt/boot. That's a mistake, the partition that contains the /boot/gptboot bootcode is not meant to be mounted because it does not have a filesystem. Do you mean to mount some other partition at /mnt/boot?


----------



## FreeDomBSD (Apr 13, 2013)

Thank you for reply. I know there is a mistake somewhere with partitions. I do not fully understand what I am doing (big part of the problem/problemsolving equation). Here is the relevant section in the guide that I'm following:




			
				blakkheim said:
			
		

> ```
> zpool create -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache tank mirror /dev/ada1.eli /dev/ada2.eli
> zpool export tank
> zpool import -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache tank
> ...


----------



## kpa (Apr 13, 2013)

Looking at the parts of the guide you quoted it seems that you're not even following it to the letter but trying to adapt it without understanding what you're doing. The guide clearly shows MBR partititioning on the disk but you're using GPT.


----------



## FreeDomBSD (Apr 17, 2013)

It worked!


----------



## DutchDaemon (Apr 17, 2013)

@FreeDomBSD, do not mass-delete your posts, it makes topics entirely incomprehensible.


----------



## FreeDomBSD (Apr 19, 2013)

It helps me think.


----------

