Darle formato a una memoria USB

De NetBSD Mexico

Contenido

[editar] Identificando la memoria USB

Sólo tienes que checar el dmesg de tu sistema:

# dmesg
...
umass0 at uhub4 port 3 configuration 1 interface 0
umass0: Kingston DT 101 II, rev 2.00/1.10, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Kingston, DT 101 II, PMAP> disk removable
sd0: 7660 MB, 1922 cyl, 255 head, 32 sec, 512 bytes/sect x 15687680 sectors

[editar] Reiniciando su tabla de particiones

Para borrar la tabla de particiones actual:

# dd if=/dev/zero of=/dev/rsd0d bs=512 count=1
1+0 records in
1+0 records out
512 bytes transferred in 0.265 secs (1932 bytes/sec)

[editar] Crear la nueva partición

Para crear la partición que sea compatible con Windows, Linux y otros BSDs:

# fdisk -u /dev/rsd0d
fdisk: primary partition table invalid, no magic in sector 0
Disk: /dev/rsd0d
NetBSD disklabel disk geometry:
cylinders: 1922, heads: 255, sectors/track: 32 (8160 sectors/cylinder)
total sectors: 15687680

BIOS disk geometry:
cylinders: 976, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 15687680

Do you want to change our idea of what BIOS thinks? [n] n

Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Which partition do you want to change?: [none] 0
The data for partition 0 is:
<UNUSED>
sysid: [0..255 default: 169] 12
start: [0..977cyl default: 63, 0cyl, 0MB] <Enter>
size: [0..977cyl default: 15687617, 977cyl, 7660MB] <Enter>
bootmenu: [] <Enter>

Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
start 63, size 15687617 (7660 MB, Cyls 0-976/130/50)
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Which partition do you want to change?: [none] <Enter>
We haven't written the MBR back to disk yet.  This is your last chance.
Partition table:
  0: Primary DOS with 32 bit FAT - LBA (sysid 12)
start 63, size 15687617 (7660 MB, Cyls 0-976/130/50)
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Should we write new partition table? [n] y

NOTA

Lo que esta en negritas son las opciones que escogimos.

[editar] Formatear la partición

Checamos cual es la letra de la partición:

# mbrlabel /dev/rsd0d
Found MSDOS partition; size 15687617 (7659 MB), offset 63
adding MSDOS partition to slot a.

5 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
a:  15687617        63      MSDOS                     # (Cyl.      0*-   1922*)
d:  15687680         0     unused      0     0        # (Cyl.      0 -   1922*)
e:  15679378        62      MSDOS                     # (Cyl.      0*-   1921*)

Not updating disk label.

En este caso es la letra e.

Formateamos:

# newfs_msdos -F 32 -L EUNICE /dev/rsd0e
/dev/rsd0e: 15657064 sectors in 1957133 FAT32 clusters (4096 bytes/cluster)
MBR type: 11
bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=32 hds=255 hid=0 bsec=15687680 bspf=15291 rdcl=2 infs=1 bkbs=2

[editar] Usar la memoria

Montamos:

# mount_msdos -o rw -m 777 /dev/sd0e /mnt/usb

Checamos su espacio libre:

# df -h
Filesystem        Size       Used      Avail %Cap Mounted on
...
/dev/sd0e         7.5G       4.0K       7.5G   0% /mnt/usb
Herramientas personales