LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 09-24-2018, 03:52 AM   #1
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Rep: Reputation: Disabled
Need to format USB flash drive under OpenBSD


Need to format USB flash drive under OpenBSD.

1) Which filesystem should I use ?

2) What is the command to format an USB flash drive ?

Presently its formatted to Ext4 and mounts only read only.

This is how I am mounting it

Code:
mount -r /dev/sd1i /mnt
Please reply.
 
Old 09-24-2018, 07:30 AM   #2
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 2,679

Rep: Reputation: Disabled
Use a disk formatted to ext2 if you want to use it with both Linux & OpenBSD.

(Or else use fat/vfat.)


If you only intend using it under OpenBSD, you can format it under the system to use its own file system.

https://www.openbsd.org/faq/faq14.html

Or use one of these.
https://man.openbsd.org/?query=mount_&sec=8&apropos=1

Last edited by fatmac; 09-24-2018 at 07:31 AM.
 
1 members found this post helpful.
Old 09-24-2018, 07:39 AM   #3
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 2,679

Rep: Reputation: Disabled
From my own personal notebook :-

fdisk (-e) creates MBR slices/partitions
disklabel (-e) creates BSD partitions

fdisk -e sd0 (a6)
disklabel -e sd0 (unused)
newfs /dev/rsd0c

These are just notes to myself, as a reminder, but may be useful to you.
 
Old 09-24-2018, 08:42 AM   #4
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fatmac View Post
Use a disk formatted to ext2 if you want to use it with both Linux & OpenBSD.

(Or else use fat/vfat.)


If you only intend using it under OpenBSD, you can format it under the system to use its own file system.

https://www.openbsd.org/faq/faq14.html

Or use one of these.
https://man.openbsd.org/?query=mount_&sec=8&apropos=1
Code:
# newfs /dev/sd1i                                                                                    
newfs_ext2fs: /dev/sd1i: block device
What did do wrong ?
 
Old 09-24-2018, 08:43 AM   #5
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fatmac View Post
From my own personal notebook :-

fdisk (-e) creates MBR slices/partitions
disklabel (-e) creates BSD partitions

fdisk -e sd0 (a6)
disklabel -e sd0 (unused)
newfs /dev/rsd0c

These are just notes to myself, as a reminder, but may be useful to you.
Code:
# fdisk -e sd1   
Enter 'help' for information
fdisk: 1> disklabel -e sd1
Invalid command 'disklabel'.  Try 'help'.
Please help me step by step.
 
Old 09-24-2018, 09:04 AM   #6
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 3,521
Blog Entries: 3

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
Try 'help'

You need to add a new partition of the type 'ext2fs'

Check section 14 of the FAQ again. Then reread the manual page for disklabel(8) and newfs(8)

Code:
disklabel -E sd2c

# echo -n 'a i\n\n\next2fs\nw\nq\n' | disklabel -E sd2c

newfs -t ext2fs sd2i
That is for sd2, substitute the relevant device.

Last edited by Turbocapitalist; 09-24-2018 at 09:11 AM. Reason: dd
 
1 members found this post helpful.
Old 09-24-2018, 09:37 AM   #7
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
Try 'help'

You need to add a new partition of the type 'ext2fs'

Check section 14 of the FAQ again. Then reread the manual page for disklabel(8) and newfs(8)

Code:
disklabel -E sd2c

# echo -n 'a i\n\n\next2fs\nw\nq\n' | disklabel -E sd2c

newfs -t ext2fs sd2i
That is for sd2, substitute the relevant device.
All I did was

Code:
newfs -t ext2fs sd2i
and it worked but now I when I navigate to /mnt using thunar I cant write any files to the partition.

Code:
# mount
/dev/sd0a on / type ffs (local)
/dev/sd0k on /home type ffs (local, nodev, nosuid)
/dev/sd0d on /tmp type ffs (local, nodev, nosuid)
/dev/sd0f on /usr type ffs (local, nodev)
/dev/sd0g on /usr/X11R6 type ffs (local, nodev)
/dev/sd0h on /usr/local type ffs (local, nodev, wxallowed)
/dev/sd0j on /usr/obj type ffs (local, nodev, nosuid)
/dev/sd0i on /usr/src type ffs (local, nodev, nosuid)
/dev/sd0e on /var type ffs (local, nodev, nosuid)
/dev/sd1i on /mnt type ext2fs (local)
 
Old 09-24-2018, 09:40 AM   #8
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 3,521
Blog Entries: 3

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
Who is the current owner of the mounted partition? Check that and change it if needed if you want the whole partition.
 
1 members found this post helpful.
Old 09-24-2018, 09:50 AM   #9
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
Who is the current owner of the mounted partition? Check that and change it if needed if you want the whole partition.
I did

Code:
# chown myusername:users /mnt/pen/
and now its working. Thanks a lot.

Last edited by hifi100; 09-24-2018 at 09:52 AM.
 
Old 10-09-2018, 10:18 AM   #10
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
I want to format another USB flash drive.

This time I want FAT32.

Please give me the command.
 
Old 10-09-2018, 11:02 AM   #11
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
Solved. Done the formatting using a Puppy Linux live CD.
 
Old 10-09-2018, 12:26 PM   #12
jggimi
Member
 
Registered: Jan 2016
Distribution: None. Just OpenBSD.
Posts: 168

Rep: Reputation: 59
Quote:
Originally Posted by hifi100 View Post
Please give me the command.
For next time: see the newfs_msdos(8) man page. To format partition sd2i as FAT32, use:
Code:
# newfs_msdos -F 32 sd2i
 
Old 10-09-2018, 12:31 PM   #13
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jggimi View Post
For next time: see the newfs_msdos(8) man page. To format partition sd2i as FAT32, use:
Code:
# newfs_msdos -F 32 sd2i
I did that. It finished but when trying to mount it failed with some "FFS" message. Sorry I don't remember the exact error. I rebooted but the error was still there.
 
Old 10-09-2018, 01:00 PM   #14
jggimi
Member
 
Registered: Jan 2016
Distribution: None. Just OpenBSD.
Posts: 168

Rep: Reputation: 59
For next time: record your actions and your error messages. The more accurate you can be when describing a problem, the more likely someone will be able to provide you with either a solution or an explanation.
 
Old 10-09-2018, 01:03 PM   #15
hifi100
Member
 
Registered: Sep 2016
Distribution: OpenBSD 6.3
Posts: 159

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jggimi View Post
For next time: record your actions and your error messages. The more accurate you can be when describing a problem, the more likely someone will be able to provide you with either a solution or an explanation.
Okay/Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Installing OpenBSD to a bootable USB flash drive LXer Syndicated Linux News 0 04-23-2011 03:32 AM
How to format a USB flash drive Randy Skaman Linux - Hardware 1 10-18-2009 03:24 PM
Can't format USB flash drive, write protection krisbitner Linux - Hardware 5 02-07-2007 04:18 PM
How to format a usb flash drive eypros Linux - Software 4 04-19-2006 02:06 PM
How to format a USB flash drive? Erik_the_Red Linux - Hardware 4 08-29-2005 01:47 PM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration