DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 13th July 2015
betweendayandnight betweendayandnight is offline
friendly
 
Join Date: Jul 2015
Posts: 67
Default Remove a line in fstab

I thought it would be easier for me to mount flash drives automatically if I did the following to fstab:

Code:
/dev/sd1i /mnt/usb
(sd1i is found from sysctl hw.disknames)

I rebooted the box with the USB 3.0 flash drive still inserted in the USB 3.0 port.

During the boot process, the following errors were detected:

Code:
/dev/rsd1i: BAD SUPER BLOCK: MAGIC NUMBER WRONG
/dev/rsd1i: Unexpected inconsistency: Run fsck_ffs manually
The following file system had an unexpected inconsistency: ffs: /dev/rsd1i (/mnt/usb)
Automatic file system check failed; help!
Enter pathname of shell or RETURN for sh:
I checked out the article "How to use ed to edit /etc/fstab in single user mode" (http://www.openbsdsupport.org/ed_and_fstab.html) which discussed about how to use ed to modify lines but not to delete them.
Reply With Quote
  #2   (View Single Post)  
Old 13th July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,254
Default

Hello, and welcome!

You can still use ed(1), just put a "#" -- called a hash or a pound sign -- in the first column of the offending line, with something like
Code:
,s;/dev/sd1i /mnt/usb;#;g
Or, you could correct the line per the fstab(5) man page.*

You could also manually mount the rest of your filesystems in /etc/fstab, including the all-important /usr which contains the rest of the built-in editors in /usr/bin, then export a $TERM environment variable, and use an editor you are more comfortable with such as vi(1) or mg(1).

--

OpenBSD will create a virtual disklabel when a disk drive has MBR partitions but no OpenBSD disklabel on the drive. Recognized foreign filesystems in the MBR partition table will be assigned disklabel partitions beginning with "i". Assuming the drive will be assigned to device sd1 when inserted, the fstab entry for a FAT formatted drive drive should look something like this:
Code:
/dev/sd1i /mnt/usb msdos rw,noauto 0 0
Details of the syntax and the "noauto" option are discussed in the fstab(5) man page.
Reply With Quote
  #3   (View Single Post)  
Old 13th July 2015
betweendayandnight betweendayandnight is offline
friendly
 
Join Date: Jul 2015
Posts: 67
Default

Quote:
Originally Posted by jggimi View Post
Hello, and welcome!
Thanks

Quote:
Originally Posted by jggimi View Post
You can still use ed(1), just put a "#" -- called a hash or a pound sign -- in the first column of the offending line, with something like
Code:
,s;/dev/sd1i /mnt/usb;#;g
The offending line happens to be line 11. Do I need to amend your command to:

Code:
11,s;/dev/sd1i /mnt/usb;#;g
or

Code:
11,s,11;/dev/sd1i /mnt/usb;#;g
Quote:
Originally Posted by jggimi View Post
then export a $TERM environment variable, and use an editor you are more comfortable with such as vi(1) or mg(1).
Is the following the correct command to export a $TERM environment variable?

Code:
export TERM=vt220
Quote:
Originally Posted by jggimi View Post
OpenBSD will create a virtual disklabel when a disk drive has MBR partitions but no OpenBSD disklabel on the drive. Recognized foreign filesystems in the MBR partition table will be assigned disklabel partitions beginning with "i". Assuming the drive will be assigned to device sd1 when inserted, the fstab entry for a FAT formatted drive drive should look something like this:
Code:
/dev/sd1i /mnt/usb msdos rw,noauto 0 0
Details of the syntax and the "noauto" option are discussed in the fstab(5) man page.
Thanks for the above info.
Reply With Quote
  #4   (View Single Post)  
Old 13th July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,254
Default

Quote:
Originally Posted by betweendayandnight View Post
Thanks

The offending line happens to be line 11. Do I need to amend your command...
No, the leading ",s" combined with the trailing "g" will make the change globally, for every line that matches.

You can add or remove line breaks in these commands by referring to new lines escaped with a backslash. But it takes some practice. I do it now and again, but sometimes confuse myself. For example, to break every "keyboard" in a file with a line break between "key" and "board," one would type:
Code:
,s/keyboard/key\
board/g
Quote:
Is the following the correct command to export a $TERM environment variable?

Code:
export TERM=vt220
Yes.
Reply With Quote
  #5   (View Single Post)  
Old 13th July 2015
betweendayandnight betweendayandnight is offline
friendly
 
Join Date: Jul 2015
Posts: 67
Default

Quote:
Originally Posted by jggimi View Post
But it takes some practice. I do it now and again, but sometimes confuse myself. For example, to break every "keyboard" in a file with a line break between "key" and "board," one would type:
Code:
,s/keyboard/key\
board/g
Yes.
I agree with you. It's quite a steep learning curve for me to learn how to use ed

I managed to remove the offending line by first mounting the relevant partitions using the 16-alphanumeric-string UUIDs to / , /usr and /var

Secondly I

Code:
export TERM=vt220
Thirdly I

Code:
nano /etc/fstab
removed the offending line and rebooted.
Reply With Quote
  #6   (View Single Post)  
Old 13th July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,254
Default

Excellent! Glad you got things repaired.
Reply With Quote
Reply

Tags
delete, fstab

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
usbconfig for fstab bashrules FreeBSD General 3 6th January 2013 02:05 AM
Help with some more sensible fstab defaults maxrussell FreeBSD General 4 18th July 2009 02:44 PM
C F Card and fstab terryd FreeBSD General 1 3rd December 2008 05:26 PM
Mounting ext2 in fstab latorion FreeBSD General 3 6th August 2008 04:56 PM
fstab and CD/DVD device corneliu FreeBSD General 7 24th May 2008 02:11 AM


All times are GMT. The time now is 12:33 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick