fat32

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 11 Imported by: 14

Documentation

Overview

Package fat32 provides utilities to interact with, manipulate and create a FAT32 filesystem on a block device or a disk image.

references:

https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system
https://www.cs.fsu.edu/~cop4610t/assignments/project3/spec/fatspec.pdf
https://wiki.osdev.org/FAT

Index

Constants

View Source
const (
	// FirstRemovableDrive is first removable drive
	FirstRemovableDrive uint8 = 0x00
	// FirstFixedDrive is first fixed drive
	FirstFixedDrive uint8 = 0x80
)
View Source
const (
	// KB represents one KB
	KB int64 = 1024
	// MB represents one MB
	MB int64 = 1024 * KB
	// GB represents one GB
	GB int64 = 1024 * MB
	// TB represents one TB
	TB int64 = 1024 * GB
	// Fat32MaxSize is maximum size of a FAT32 filesystem in bytes
	Fat32MaxSize int64 = 2198754099200
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FSInformationSector

type FSInformationSector struct {
	// contains filtered or unexported fields
}

FSInformationSector is a structure holding the FAT32 filesystem information sector

type FileSystem

type FileSystem struct {
	*fat12.FileSystem
	// contains filtered or unexported fields
}

FileSystem implements filesystem.FileSystem for FAT32. It embeds *fat12.FileSystem to inherit all high-level filesystem methods (OpenFile, ReadDir, Mkdir, Remove, Rename, Stat, Label, allocateSpace, …). Only FAT32-specific behaviour is implemented here: the dos71EBPB boot sector format, the FSInformationSector, and the backup boot sector.

func Create

func Create(b backend.Storage, size, start, blocksize int64, volumeLabel string, reproducible bool) (*FileSystem, error)

Create creates a FAT32 filesystem on the given backend.

func Read

func Read(b backend.Storage, size, start, blocksize int64) (*FileSystem, error)

Read reads a FAT32 filesystem from the backend.

func (*FileSystem) SetLabel added in v1.3.0

func (fs *FileSystem) SetLabel(volumeLabel string) error

SetLabel changes the filesystem volume label. Overrides fat12.FileSystem.SetLabel to update the FAT32-format dos71EBPB and write the backup boot sector.

func (*FileSystem) Type

func (fs *FileSystem) Type() filesystem.Type

Type returns filesystem.TypeFat32.

type MsdosMediaType

type MsdosMediaType uint8

MsdosMediaType is the (mostly unused) media type.

const (
	Media8InchDrDos             MsdosMediaType = 0xe5
	Media525InchTandy           MsdosMediaType = 0xed
	MediaCustomPartitionsDrDos  MsdosMediaType = 0xee
	MediaCustomSuperFloppyDrDos MsdosMediaType = 0xef
	Media35Inch                 MsdosMediaType = 0xf0
	MediaDoubleDensityAltos     MsdosMediaType = 0xf4
	MediaFixedDiskAltos         MsdosMediaType = 0xf5
	MediaFixedDisk              MsdosMediaType = 0xf8
)

type SectorSize

type SectorSize = fat12.SectorSize

SectorSize is an alias for fat12.SectorSize so that fat32.SectorSize512 is directly usable in fat12.Dos20BPB struct literals.

const (
	SectorSize512 SectorSize = 512
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL