Formatejant un disc dur extern de 160Gb en FAT32 a OpenBSD

Formatejant un disc dur extern de 160Gb en FAT32 a OpenBSD

L'altre dia vaig comprar-me per 5 eurets aquest adaptador Maiwo de disc dur 2.5'' SATA per a connectar un disc dur de 160Gb d'un portàtil antic. I avui volia muntar-lo i fer-lo servir per a uns projectes que tinc, i finalment he decidit formatejar-los en format FAT32.

Per a començar, veurem la informació sobre el meu USB extern amb disklabel:

# disklabel sd1
# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: HM160HI
duid: 0000000000000000
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 19457
total sectors: 312581808
boundstart: 0
boundend: 312581808
drivedata: 0


16 partitions:
# size offset fstype [fsize bsize cpg]
c: 312581808 0 unused
i: 312576642 63 unknown

Formatejant un disc dur extern de 160Gb en FAT32 a OpenBSD

Ara anem a llistar (tecla 'p') les particions del disc dur, i a continuació esborrarem (tecla 'd') la partició "i".
I finalment crearem una partició a tot el disc (tecla 'A'). I eixirem guardant (tecla 'q'):

# disklabel -E sd1
Label editor (enter '?' for help at any prompt)
> p
OpenBSD area: 0-312581808; size: 312581808; free: 5166
# size offset fstype [fsize bsize cpg]
c: 312581808 0 unused
i: 312576642 63 unknown
> l
# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: HM160HI
duid: 0000000000000000
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 19457
total sectors: 312581808
boundstart: 0
boundend: 312581808
drivedata: 0
> ?
Available commands:
? | h - show help n [part] - set mount point
A - auto partition all space p [unit] - print partitions
a [part] - add partition q - quit & save changes
b - set OpenBSD boundaries R [part] - resize auto allocated partition
c [part] - change partition size r - display free space
D - reset label to default s [path] - save label to file
d [part] - delete partition U - undo all changes
e - edit drive parameters u - undo last change
g [d|u] - [d]isk or [u]ser geometry w - write label to disk
i - modify disklabel UID X - toggle expert mode
l [unit] - print disk label header x - exit & lose changes
M - disklabel(8) man page z - delete all partitions
m [part] - modify partition


Suffixes can be used to indicate units other than sectors:
'b' (bytes), 'k' (kilobytes), 'm' (megabytes), 'g' (gigabytes) 't' (terabytes)
'c' (cylinders), '%' (% of total disk), '&' (% of free space).
Values in non-sector units are truncated to the nearest cylinder boundary.
> p
OpenBSD area: 0-312581808; size: 312581808; free: 5166
# size offset fstype [fsize bsize cpg]
c: 312581808 0 unused
i: 312576642 63 unknown
> d i
> p
OpenBSD area: 0-312581808; size: 312581808; free: 312581808
# size offset fstype [fsize bsize cpg]
c: 312581808 0 unused
> A
> p
OpenBSD area: 0-312581808; size: 312581808; free: 110
# size offset fstype [fsize bsize cpg]
a: 5056 312576736 4.2BSD 2048 16384 1 # /
c: 312581808 0 unused
i: 312576642 63 unknown
> q
Write new label?: [y] y

Li donem format de FAT32 al dispositiu (/dev/sd1i)

# newfs_msdos -F 32 sd1i
/dev/rsd1i: 311967296 sectors in 38995912 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 mid=0xf8 spt=63 hds=255 hid=63 bsec=312576642 bspf=304656 rdcl=2 infs=1 bkbs=2

I finalment, comprovem que tenim el disc de 2'5 muntat correctament al punt de muntatge /mnt on ens mostra que tenim 149 Gb d'espai:

# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/sd0a 1005M 158M 796M 17% /
/dev/sd0k 298G 48.5G 234G 17% /home
/dev/sd0d 3.9G 908K 3.7G 0% /tmp
/dev/sd0f 2.0G 1.1G 761M 60% /usr
/dev/sd0g 1005M 178M 777M 19% /usr/X11R6
/dev/sd0h 9.8G 5.9G 3.5G 63% /usr/local
/dev/sd0j 5.9G 2.0K 5.6G 0% /usr/obj
/dev/sd0i 2.0G 2.0K 1.9G 0% /usr/src
/dev/sd0e 19.1G 56.4M 18.1G 0% /var
/dev/sd1i 149G 12.0K 149G 0% /mnt

Muntem el dispositu amb:

# mount_msdos /dev/sd1i /mnt/

Un resum seria:

# fdisk -iy
# fdisk -e
# newfs_msdos -F 32 i

Espere que t'ajude aquest article i et motive a escriure els teus propis articles sobre UNIX o GNU/* o Hacktivisme o Programari Lliure en general.