LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 02:52 AM   #1
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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, 06:30 AM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

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 06:31 AM.
 
1 members found this post helpful.
Old 09-24-2018, 06:39 AM   #3
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

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, 07:42 AM   #4
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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, 07:43 AM   #5
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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, 08:04 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,308
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
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 08:11 AM. Reason: dd
 
1 members found this post helpful.
Old 09-24-2018, 08:37 AM   #7
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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, 08:40 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,308
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
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, 08:50 AM   #9
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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 08:52 AM.
 
Old 10-09-2018, 09:18 AM   #10
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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, 10:02 AM   #11
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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

Rep: Reputation: 169Reputation: 169
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, 11:31 AM   #13
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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, 12:00 PM   #14
jggimi
Member
 
Registered: Jan 2016
Distribution: None. Just OpenBSD.
Posts: 289

Rep: Reputation: 169Reputation: 169
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, 12:03 PM   #15
hifi100
Member
 
Registered: Sep 2016
Location: India
Distribution: Arch Linux
Posts: 357

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



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 02:32 AM
How to format a USB flash drive Randy Skaman Linux - Hardware 1 10-18-2009 02:24 PM
Can't format USB flash drive, write protection krisbitner Linux - Hardware 5 02-07-2007 03:18 PM
How to format a usb flash drive eypros Linux - Software 4 04-19-2006 01:06 PM
How to format a USB flash drive? Erik_the_Red Linux - Hardware 4 08-29-2005 12:47 PM

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

All times are GMT -5. The time now is 06:45 PM.

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
Open Source Consulting | Domain Registration