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 9th March 2018
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default usb flash drive insists on being read-only

I have a 2GB usb flash drive which contains some old Debian files that I want to delete.

I've tried mounting it with "-o rw" and also tried "mount -u -o rw" when it's mounted but it remains obstinately read-only. Is there any way to fix this or should I ditch the drive?
Reply With Quote
  #2   (View Single Post)  
Old 9th March 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

What is the filesystem?
Reply With Quote
  #3   (View Single Post)  
Old 9th March 2018
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

It's cd9660, which seems odd.
Reply With Quote
  #4   (View Single Post)  
Old 9th March 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

That *is* a read-only filesystem. You can back up the contents, reformat into a useable filesystem, and reload.
Reply With Quote
  #5   (View Single Post)  
Old 9th March 2018
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

The contents are unimportant. I'd thought about reformatting but I don't know how to go about doing that in OBSD. Would I use newfs after first running disklabel?
Reply With Quote
  #6   (View Single Post)  
Old 9th March 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

For a drive that might be inserted into multiple OSes, I recommend you start with an MBR. You can use fdisk(8) to create an MBR. The initialized (or reinitialized) default configuration is of a single OpenBSD MBR partition spanning the drive. The fdisk(8) program has an editor which can revise these, or make GPT partitions instead of MBRs. However, some knowledge of how MBR/GPT partitions function is needed to effectively make changes.

To create a default, initial MBR, you can use # fdisk -iy <device>. See the man page for details.

As you noted, you can create OpenBSD disklabel partitions with disklabel(8) and its editor.

Formatting of FFS partitions in OpenBSD is performed with newfs(8).
Reply With Quote
  #7   (View Single Post)  
Old 9th March 2018
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

Many thanks, Iggimi; very useful info, as always.
Reply With Quote
  #8   (View Single Post)  
Old 9th March 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,975
Default

You're welcome. For clarity, what this creates is an OpenBSD-only removable device. The MBR will keep all other OSes from scribbling on it unless you tell them to reformat. They will recognize the MBR, and the one entry in the partition table will inform the OS that the drive is reserved for something they know nothing about.

If you want a storage device that can be used with other OSes, then the MBR becomes the tool to define a filesystem (such as FAT) that can be shared among the OSes. An OpenBSD disklabel is not actually needed, because when there is no on-disk disklabel, OpenBSD will read the MBR partition table and create a virtual disklabel, assigning disklabel partitions to MBR partitions that it recognizes, starting with partition "i".

(If you have an MBR *and* a disklabel, the two must be manually kept in sync, as OpenBSD will not scan for foreign filesystems in the MBR partition table, and will use the disklabel instead.)

Last edited by jggimi; 9th March 2018 at 09:16 PM. Reason: edit: added the last paragraph
Reply With Quote
Reply

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
formatting USB Flash Drive amphibious OpenBSD Installation and Upgrading 4 20th April 2017 01:49 AM
External USB Drive suddenly Read only kerasi OpenBSD General 8 17th March 2015 01:12 PM
Creating USB flash drive drive image from FreeBSD disc1.iso FBSD Guides 1 10th February 2010 04:42 PM
Backup to USB flash drive giga FreeBSD General 5 8th December 2008 11:06 PM
USB flash drive criglerj NetBSD General 1 26th July 2008 01:25 AM


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


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