DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 3 Weeks Ago
gustaf gustaf is offline
Port Guard
 
Join Date: Dec 2016
Posts: 19
Default Formatting MSDOS drive

I just bought a Seagate Backup Plus 2TB external USB hard drive for backing up my OpenBSD files. The factory-installed file system (not listed on the box) is (or was) NTFS -- read-only in OpenBSD. Obviously, I need to reformat this drive if I want to use it.

Disk formatting in OpenBSD is truly intimidating. I just want to plug in a drive and format it as MSDOS for maximum compatibility with other operating systems. Smaller-sized drives are easy. I plug them into my OS9 Mac, format them as DOS, and I'm good to go. That works until the drive gets too big for the Mac to handle. Hence, my current problem.

Long story short, I plugged this 2TB drive into my OS9 Mac and initialized it as "DOS 1,863GB". The end result was a 7GB capacity drive.

I plugged the drive into OpenBSD and ran:

Code:
$ disklabel -h sd1

# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: BUP Slim BK     
duid: 0000000000000000
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 243201
total sectors: 3907029167 # total bytes: 1863.0G
boundstart: 0
boundend: 3907029167
drivedata: 0 

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  c:          1863.0G                0  unused                    
  i:             7.0G               32   MSDOS
That's mostly what I wanted -- an MSDOS drive with two partitions, c and i -- except that partition i should be 1863.0G.

newfs(8) seemed like the best option for increasing the size of this partition.

Starting with disklabel(8), I ran $ disklabel -e sd1 and changed the size of partition i to 3907029135 (3907029167 minus 32, to account for the offset), then checked the partition size and available free space:

Code:
$ df -h

Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd1i      7.0G    8.0K    7.0G     0%    /path/to/mount-point
I still needed to rebuild the file system on the disk.

I printed the file system parameters:

Code:
$ newfs -N -t msdos sd1i

/dev/rsd1i: 3903217360 sectors in 243951085 FAT32 clusters (8192 bytes/cluster)
bps=512 spc=16 res=32 nft=2 mid=0xf8 spt=63 hds=255 hid=32 bsec=3907029135 bspf=1905868 rdcl=2 infs=1 bkbs=2
and reconstructed the file system:

Code:
$ newfs -t msdos sd1i

I think it worked!

Code:
$ disklabel -h sd1

# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: BUP Slim BK     
duid: afb5ddb4eca1df71
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 243201
total sectors: 3907029167 # total bytes: 1.8T
boundstart: 0
boundend: 3907029167
drivedata: 0 

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  c:             1.8T                0  unused                    
  i:             1.8T               32   MSDOS

Code:
$ df -h

Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd1i      1.8T    8.0K    1.8T     0%    /path/to/mount-point

Code:
$ fdisk sd1

Disk: sd1       geometry: 243201/255/63 [3907029167 Sectors]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 0C      0   0  33 -    915 244  33 [          32:    14714848 ] FAT32L      
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused

Did I do this correctly and is there anything I should be aware of before writing a backup to this drive?

Also, does anyone know if there is a good reference on the nuts and bolts of disk formatting?

Thanks.
Reply With Quote
 

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
codepage and iocharset in fat32 aka msdos filesystem e1-531g OpenBSD General 3 18th January 2016 06:53 PM
Corrupted msdos filesystem on a compactflash card - recovery algkalv FreeBSD General 4 6th January 2010 12:30 AM
Formatting Hard Disk Drive to UFS in OS X 10.5 Turquoise88 Other BSD and UNIX/UNIX-like 1 7th March 2009 09:57 PM
Formatting fat32 drive quickly map7 FreeBSD General 10 26th July 2008 05:17 PM


All times are GMT. The time now is 09:41 PM.


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