diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,18 @@
+# Changelog
+
+All notable changes to this project are documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
+and this project adheres to the
+[Haskell Package Versioning Policy](https://pvp.haskell.org/).
+
+## [Unreleased]
+
+## [0.1.0.0] - 2026-11-27
+
+### Added
+
+- Initial library skeleton with common NTFS domain types.
+- Pure parser for the NTFS boot sector and volume geometry helpers.
+- `NTFS.Volume` with boot-sector loading, cluster offsets and MFT record reads.
+- `NTFS.MFT.Record` with header parsing, update sequence fix-up and raw attribute slices.
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2026, Joonkyu Park
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+# ntfs
+
+A Haskell library for reading NTFS disk images. The goal is to build up from
+the volume structure: boot sector, MFT records, attributes and runlists first,
+then a high-level file system API.
+
+## Status
+
+Early development. The boot sector parser and volume-level MFT record reads
+are available so far.
+
+## Building
+
+    cabal build
+    cabal test
diff --git a/ntfs.cabal b/ntfs.cabal
new file mode 100644
--- /dev/null
+++ b/ntfs.cabal
@@ -0,0 +1,45 @@
+cabal-version:      2.4
+name:               ntfs
+version:            0.1.0.0
+synopsis:           Pure Haskell library for reading NTFS disk images
+description:
+  Low-level parsers for NTFS volume geometry, MFT records, attributes and
+  runlists, with a high-level file system API built on top.
+
+license:            BSD-3-Clause
+license-file:       LICENSE
+author:             Joonkyu Park
+maintainer:         vpark45@gmail.com
+homepage:           https://github.com/nattybear/ntfs
+bug-reports:        https://github.com/nattybear/ntfs/issues
+category:           System
+build-type:         Simple
+extra-doc-files:    CHANGELOG.md
+                    README.md
+
+source-repository head
+  type:              git
+  location:          https://github.com/nattybear/ntfs
+
+library
+  exposed-modules:    NTFS
+                      NTFS.BootSector
+                      NTFS.MFT.Record
+                      NTFS.Types
+                      NTFS.Volume
+  hs-source-dirs:     src
+  build-depends:      base       >= 4.14 && < 5
+                    , bytestring >= 0.10 && < 0.13
+  default-language:   Haskell2010
+  ghc-options:        -Wall
+
+test-suite ntfs-test
+  type:               exitcode-stdio-1.0
+  main-is:            Spec.hs
+  hs-source-dirs:     test
+  build-depends:      base       >= 4.14 && < 5
+                    , bytestring >= 0.10 && < 0.13
+                    , directory  >= 1.3  && < 1.4
+                    , ntfs
+  default-language:   Haskell2010
+  ghc-options:        -Wall
diff --git a/src/NTFS.hs b/src/NTFS.hs
new file mode 100644
--- /dev/null
+++ b/src/NTFS.hs
@@ -0,0 +1,12 @@
+-- | Public entry point for the NTFS library.
+module NTFS
+  ( module NTFS.Types
+  , module NTFS.BootSector
+  , module NTFS.MFT.Record
+  , module NTFS.Volume
+  ) where
+
+import           NTFS.BootSector
+import           NTFS.MFT.Record
+import           NTFS.Types
+import           NTFS.Volume
diff --git a/src/NTFS/BootSector.hs b/src/NTFS/BootSector.hs
new file mode 100644
--- /dev/null
+++ b/src/NTFS/BootSector.hs
@@ -0,0 +1,111 @@
+-- | Pure parser for the NTFS volume boot record (VBR).
+module NTFS.BootSector
+  ( BootSector (..)
+  , bootSectorSize
+  , parseBootSector
+  , bytesPerCluster
+  , mftRecordSize
+  , indexRecordSize
+  ) where
+
+import           Data.Bits       (shiftL, (.|.))
+import qualified Data.ByteString as BS
+import           Data.Int        (Int8)
+import           Data.Word       (Word16, Word32, Word64, Word8)
+
+import           NTFS.Types      (ClusterSize (..), LCN (..), ParseError (..))
+
+-- | Size of a boot sector in bytes.
+bootSectorSize :: Int
+bootSectorSize = 512
+
+-- | Geometry and offsets read from the volume boot record.
+data BootSector = BootSector
+  { bsBytesPerSector       :: Word16
+  , bsSectorsPerCluster    :: Word8
+  , bsReservedSectors      :: Word16
+  , bsHiddenSectors        :: Word32
+  , bsTotalSectors         :: Word64
+  , bsMFTStart             :: LCN
+  , bsMFTMirrorStart       :: LCN
+  , bsClustersPerMFTRecord :: Int8
+  , bsClustersPerIndexRec  :: Int8
+  , bsVolumeSerial         :: Word64
+  } deriving (Eq, Show)
+
+-- | Parse a 512-byte boot sector.
+parseBootSector :: BS.ByteString -> Either ParseError BootSector
+parseBootSector bytes
+  | BS.length bytes < bootSectorSize =
+      Left (UnexpectedEndOfData "boot sector is shorter than 512 bytes")
+  | word16At bytes 0x1fe /= 0xaa55 =
+      Left (InvalidValue "boot sector signature is not 0x55AA")
+  | word16At bytes 0x0b == 0 =
+      Left (InvalidValue "bytes per sector is zero")
+  | byteAt bytes 0x0d == 0 =
+      Left (InvalidValue "sectors per cluster is zero")
+  | otherwise =
+      Right
+        BootSector
+          { bsBytesPerSector = word16At bytes 0x0b
+          , bsSectorsPerCluster = byteAt bytes 0x0d
+          , bsReservedSectors = word16At bytes 0x0e
+          , bsHiddenSectors = word32At bytes 0x1c
+          , bsTotalSectors = word64At bytes 0x28
+          , bsMFTStart = LCN (fromIntegral (word64At bytes 0x30))
+          , bsMFTMirrorStart = LCN (fromIntegral (word64At bytes 0x38))
+          , bsClustersPerMFTRecord = int8At bytes 0x40
+          , bsClustersPerIndexRec = int8At bytes 0x44
+          , bsVolumeSerial = word64At bytes 0x48
+          }
+
+-- | Bytes in one cluster.
+bytesPerCluster :: BootSector -> ClusterSize
+bytesPerCluster bs =
+  ClusterSize
+    ( fromIntegral (bsBytesPerSector bs)
+        * fromIntegral (bsSectorsPerCluster bs)
+    )
+
+-- | Size in bytes of one MFT record.
+mftRecordSize :: BootSector -> Either ParseError ClusterSize
+mftRecordSize bs = recordSize "MFT record" (bsClustersPerMFTRecord bs) bs
+
+-- | Size in bytes of one index record.
+indexRecordSize :: BootSector -> Either ParseError ClusterSize
+indexRecordSize bs = recordSize "index record" (bsClustersPerIndexRec bs) bs
+
+recordSize :: String -> Int8 -> BootSector -> Either ParseError ClusterSize
+recordSize label count bs
+  | count > 0 = Right (ClusterSize (fromIntegral count * clusterBytes))
+  | count < 0 =
+      let shift = negate (fromIntegral count :: Int)
+       in if shift > 31
+            then Left (InvalidValue (label ++ " size shift is too large"))
+            else Right (ClusterSize (1 `shiftL` shift))
+  | otherwise = Left (InvalidValue (label ++ " cluster count is zero"))
+  where
+    ClusterSize clusterBytes = bytesPerCluster bs
+
+byteAt :: BS.ByteString -> Int -> Word8
+byteAt = BS.index
+
+word16At :: BS.ByteString -> Int -> Word16
+word16At bytes offset =
+  fromIntegral (byteAt bytes offset)
+    .|. (fromIntegral (byteAt bytes (offset + 1)) `shiftL` 8)
+
+word32At :: BS.ByteString -> Int -> Word32
+word32At bytes offset =
+  fromIntegral (byteAt bytes offset)
+    .|. (fromIntegral (byteAt bytes (offset + 1)) `shiftL` 8)
+    .|. (fromIntegral (byteAt bytes (offset + 2)) `shiftL` 16)
+    .|. (fromIntegral (byteAt bytes (offset + 3)) `shiftL` 24)
+
+word64At :: BS.ByteString -> Int -> Word64
+word64At bytes offset =
+  fromIntegral (word32At bytes offset)
+    .|. (fromIntegral (word32At bytes (offset + 4)) `shiftL` 32)
+
+int8At :: BS.ByteString -> Int -> Int8
+int8At bytes offset = fromIntegral (byteAt bytes offset)
diff --git a/src/NTFS/MFT/Record.hs b/src/NTFS/MFT/Record.hs
new file mode 100644
--- /dev/null
+++ b/src/NTFS/MFT/Record.hs
@@ -0,0 +1,162 @@
+-- | Pure parser for MFT record headers and attribute slices.
+module NTFS.MFT.Record
+  ( MFTRecord (..)
+  , RawAttribute (..)
+  , parseMFTRecord
+  , isRecordInUse
+  , isDirectoryRecord
+  ) where
+
+import           Data.Bits       (shiftL, shiftR, (.&.), (.|.))
+import qualified Data.ByteString as BS
+import           Data.Word       (Word16, Word32, Word64)
+
+import           NTFS.Types      (MFTRef (..), ParseError (..))
+
+-- | Header and attributes of one MFT record.
+data MFTRecord = MFTRecord
+  { recordNumber               :: Word32
+  , recordSequenceNumber       :: Word16
+  , recordHardLinkCount        :: Word16
+  , recordFirstAttributeOffset :: Word16
+  , recordFlags                :: Word16
+  , recordUsedSize             :: Word32
+  , recordAllocatedSize        :: Word32
+  , recordBaseRecord           :: MFTRef
+  , recordNextAttributeId      :: Word16
+  , recordBytes                :: BS.ByteString
+  , recordAttributes           :: [RawAttribute]
+  } deriving (Eq, Show)
+
+-- | An attribute kept as an unparsed byte slice, including its header.
+data RawAttribute = RawAttribute
+  { rawAttributeType  :: Word32
+  , rawAttributeBytes :: BS.ByteString
+  } deriving (Eq, Show)
+
+-- | Parse an MFT record. The sector size comes from the boot sector.
+parseMFTRecord :: Word16 -> BS.ByteString -> Either ParseError MFTRecord
+parseMFTRecord bytesPerSector bytes = do
+  fixed <- applyFixup bytesPerSector bytes
+  header <- parseHeader fixed
+  attributes <- parseAttributes header
+  pure header {recordAttributes = attributes}
+
+-- | Whether the record is marked as in use.
+isRecordInUse :: MFTRecord -> Bool
+isRecordInUse record = recordFlags record .&. 0x0001 /= 0
+
+-- | Whether the record describes a directory.
+isDirectoryRecord :: MFTRecord -> Bool
+isDirectoryRecord record = recordFlags record .&. 0x0002 /= 0
+
+fileSignature :: BS.ByteString
+fileSignature = BS.pack [0x46, 0x49, 0x4c, 0x45]
+
+applyFixup :: Word16 -> BS.ByteString -> Either ParseError BS.ByteString
+applyFixup bytesPerSector bytes
+  | BS.length bytes < 0x30 =
+      Left (UnexpectedEndOfData "MFT record header is truncated")
+  | BS.take 4 bytes /= fileSignature =
+      Left (InvalidValue "MFT record signature is not FILE")
+  | bytesPerSector < 2 = Left (InvalidValue "bytes per sector is too small")
+  | usaCount == 0 = Left (InvalidValue "update sequence array is empty")
+  | usaOffset < 0x30 = Left (InvalidValue "update sequence array offset is too small")
+  | usaOffset + 2 * usaCount > BS.length bytes =
+      Left (UnexpectedEndOfData "update sequence array is truncated")
+  | any outOfRange positions =
+      Left (UnexpectedEndOfData "MFT record sector trailer is truncated")
+  | any trailerMismatch positions =
+      Left (InvalidValue "MFT record update sequence number mismatch")
+  | otherwise = Right (foldl replace bytes (zip positions replacements))
+  where
+    usaOffset = fromIntegral (word16At bytes 0x04)
+    usaCount = fromIntegral (word16At bytes 0x06)
+    usn = word16At bytes usaOffset
+    sectorBytes = fromIntegral bytesPerSector
+    sectorCount = usaCount - 1
+    positions = [(i + 1) * sectorBytes - 2 | i <- [0 .. sectorCount - 1]]
+    replacements = [word16At bytes (usaOffset + 2 * (i + 1)) | i <- [0 .. sectorCount - 1]]
+    outOfRange position = position + 2 > BS.length bytes
+    trailerMismatch position = word16At bytes position /= usn
+    replace value (position, replacement) = replaceWord16 position replacement value
+
+parseHeader :: BS.ByteString -> Either ParseError MFTRecord
+parseHeader bytes
+  | BS.length bytes < 0x30 =
+      Left (UnexpectedEndOfData "MFT record header is truncated")
+  | BS.take 4 bytes /= fileSignature =
+      Left (InvalidValue "MFT record signature is not FILE")
+  | firstAttribute < 0x30 || firstAttribute > BS.length bytes =
+      Left (InvalidValue "first attribute offset is out of range")
+  | fromIntegral allocated > BS.length bytes =
+      Left (UnexpectedEndOfData "MFT record is truncated")
+  | used > allocated =
+      Left (InvalidValue "used size exceeds allocated size")
+  | otherwise =
+      Right
+        MFTRecord
+          { recordNumber = word32At bytes 0x2c
+          , recordSequenceNumber = word16At bytes 0x10
+          , recordHardLinkCount = word16At bytes 0x12
+          , recordFirstAttributeOffset = word16At bytes 0x14
+          , recordFlags = word16At bytes 0x16
+          , recordUsedSize = word32At bytes 0x18
+          , recordAllocatedSize = word32At bytes 0x1c
+          , recordBaseRecord = MFTRef (word64At bytes 0x20)
+          , recordNextAttributeId = word16At bytes 0x28
+          , recordBytes = bytes
+          , recordAttributes = []
+          }
+  where
+    firstAttribute = fromIntegral (word16At bytes 0x14)
+    used = word32At bytes 0x18
+    allocated = word32At bytes 0x1c
+
+parseAttributes :: MFTRecord -> Either ParseError [RawAttribute]
+parseAttributes header = go (fromIntegral (recordFirstAttributeOffset header))
+  where
+    bytes = recordBytes header
+    limit = fromIntegral (recordUsedSize header)
+    go offset
+      | offset > limit = Left (InvalidValue "first attribute offset exceeds used size")
+      | offset == limit = Right []
+      | offset + 8 > limit = Left (UnexpectedEndOfData "attribute header is truncated")
+      | attributeType == 0xffffffff = Right []
+      | attributeLength < 8 = Left (InvalidValue "attribute length is too small")
+      | offset + fromIntegral attributeLength > limit =
+          Left (InvalidValue "attribute length exceeds used size")
+      | otherwise = do
+          rest <- go (offset + fromIntegral attributeLength)
+          pure (RawAttribute attributeType (slice offset attributeLength) : rest)
+      where
+        attributeType = word32At bytes offset
+        attributeLength = word32At bytes (offset + 4)
+    slice offset attributeLength =
+      BS.take (fromIntegral attributeLength) (BS.drop offset bytes)
+
+word16At :: BS.ByteString -> Int -> Word16
+word16At bytes offset =
+  fromIntegral (BS.index bytes offset)
+    .|. (fromIntegral (BS.index bytes (offset + 1)) `shiftL` 8)
+
+word32At :: BS.ByteString -> Int -> Word32
+word32At bytes offset =
+  fromIntegral (word16At bytes offset)
+    .|. (fromIntegral (word16At bytes (offset + 2)) `shiftL` 16)
+
+word64At :: BS.ByteString -> Int -> Word64
+word64At bytes offset =
+  fromIntegral (word32At bytes offset)
+    .|. (fromIntegral (word32At bytes (offset + 4)) `shiftL` 32)
+
+word16Bytes :: Word16 -> BS.ByteString
+word16Bytes value =
+  BS.pack
+    [ fromIntegral value
+    , fromIntegral (value `shiftR` 8)
+    ]
+
+replaceWord16 :: Int -> Word16 -> BS.ByteString -> BS.ByteString
+replaceWord16 offset value bytes =
+  BS.take offset bytes <> word16Bytes value <> BS.drop (offset + 2) bytes
diff --git a/src/NTFS/Types.hs b/src/NTFS/Types.hs
new file mode 100644
--- /dev/null
+++ b/src/NTFS/Types.hs
@@ -0,0 +1,33 @@
+-- | Domain types shared by all NTFS parsers.
+module NTFS.Types
+  ( MFTRef (..)
+  , VCN (..)
+  , LCN (..)
+  , ClusterSize (..)
+  , ParseError (..)
+  ) where
+
+import           Data.Int  (Int64)
+import           Data.Word (Word64)
+
+-- | Record number in the Master File Table.
+newtype MFTRef = MFTRef Word64
+  deriving (Eq, Ord, Show)
+
+-- | Virtual Cluster Number, relative to the start of a file's data runs.
+newtype VCN = VCN Int64
+  deriving (Eq, Ord, Show)
+
+-- | Logical Cluster Number, relative to the start of the volume.
+newtype LCN = LCN Int64
+  deriving (Eq, Ord, Show)
+
+-- | Number of bytes in one cluster.
+newtype ClusterSize = ClusterSize Word64
+  deriving (Eq, Ord, Show)
+
+-- | Reasons why a low-level parser can fail.
+data ParseError
+  = UnexpectedEndOfData String
+  | InvalidValue String
+  deriving (Eq, Show)
diff --git a/src/NTFS/Volume.hs b/src/NTFS/Volume.hs
new file mode 100644
--- /dev/null
+++ b/src/NTFS/Volume.hs
@@ -0,0 +1,51 @@
+-- | Volume-level access to an NTFS image.
+module NTFS.Volume
+  ( Volume (..)
+  , openVolume
+  , clusterOffset
+  , mftOffset
+  , readMFTRecordBytes
+  ) where
+
+import qualified Data.ByteString as BS
+import           System.IO       (Handle, SeekMode (AbsoluteSeek), hSeek)
+
+import           NTFS.BootSector
+import           NTFS.Types
+
+-- | An open NTFS volume backed by a seekable handle.
+data Volume = Volume
+  { volumeHandle     :: Handle
+  , volumeBootSector :: BootSector
+  }
+
+-- | Read the boot sector and open the volume.
+openVolume :: Handle -> IO (Either ParseError Volume)
+openVolume handle = do
+  hSeek handle AbsoluteSeek 0
+  bytes <- BS.hGet handle bootSectorSize
+  pure (fmap (Volume handle) (parseBootSector bytes))
+
+-- | Byte offset of a logical cluster.
+clusterOffset :: Volume -> LCN -> Integer
+clusterOffset volume (LCN lcn) =
+  fromIntegral lcn * fromIntegral clusterBytes
+  where
+    ClusterSize clusterBytes = bytesPerCluster (volumeBootSector volume)
+
+-- | Byte offset of the first MFT record.
+mftOffset :: Volume -> Integer
+mftOffset volume = clusterOffset volume (bsMFTStart (volumeBootSector volume))
+
+-- | Read the bytes of one MFT record.
+readMFTRecordBytes :: Volume -> MFTRef -> IO (Either ParseError BS.ByteString)
+readMFTRecordBytes volume (MFTRef ref) =
+  case mftRecordSize (volumeBootSector volume) of
+    Left err -> pure (Left err)
+    Right (ClusterSize size) -> do
+      let offset = mftOffset volume + fromIntegral ref * fromIntegral size
+      hSeek (volumeHandle volume) AbsoluteSeek offset
+      bytes <- BS.hGet (volumeHandle volume) (fromIntegral size)
+      if fromIntegral (BS.length bytes) == size
+        then pure (Right bytes)
+        else pure (Left (UnexpectedEndOfData "MFT record is truncated"))
diff --git a/test/Spec.hs b/test/Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Spec.hs
@@ -0,0 +1,175 @@
+module Main (main) where
+
+import           Control.Exception (finally)
+import           Control.Monad     (unless)
+import           Data.Bits         (shiftR)
+import qualified Data.ByteString   as BS
+import           Data.Word         (Word16, Word32, Word64, Word8)
+import           System.Directory  (getTemporaryDirectory, removeFile)
+import           System.Exit       (exitFailure)
+import           System.IO         (SeekMode (AbsoluteSeek), hClose, hFlush,
+                                    hSeek, openBinaryTempFile)
+
+import           NTFS.BootSector
+import           NTFS.MFT.Record
+import           NTFS.Types        (ClusterSize (..), LCN (..), MFTRef (..))
+import           NTFS.Volume
+
+main :: IO ()
+main = do
+  results <-
+    mapM
+      runCheck
+      [ ("valid boot sector", pure testValidBootSector)
+      , ("short boot sector", pure testShortBootSector)
+      , ("bad signature", pure testBadSignature)
+      , ("small record sizes", pure testSmallRecordSizes)
+      , ("volume opens and reads MFT record", testVolume)
+      , ("MFT record header and attributes", pure testMFTRecord)
+      , ("MFT record bad fixup", pure testBadFixup)
+      ]
+  unless (and results) exitFailure
+
+runCheck :: (String, IO Bool) -> IO Bool
+runCheck (name, check) = do
+  ok <- check
+  putStrLn ((if ok then "PASS " else "FAIL ") ++ name)
+  pure ok
+
+testValidBootSector :: Bool
+testValidBootSector =
+  case parseBootSector bootSector of
+    Right bs ->
+      bsBytesPerSector bs == 512
+        && bsSectorsPerCluster bs == 8
+        && bsMFTStart bs == LCN 4
+        && bsVolumeSerial bs == 0x1234
+        && bytesPerCluster bs == ClusterSize 4096
+    Left _ -> False
+
+testShortBootSector :: Bool
+testShortBootSector =
+  case parseBootSector (BS.replicate 511 0) of
+    Left _  -> True
+    Right _ -> False
+
+testBadSignature :: Bool
+testBadSignature =
+  case parseBootSector (BS.replicate bootSectorSize 0) of
+    Left _  -> True
+    Right _ -> False
+
+testSmallRecordSizes :: Bool
+testSmallRecordSizes =
+  case parseBootSector bootSector of
+    Right bs ->
+      mftRecordSize bs == Right (ClusterSize 1024)
+        && indexRecordSize bs == Right (ClusterSize 512)
+    Left _ -> False
+
+testVolume :: IO Bool
+testVolume = do
+  tmpDir <- getTemporaryDirectory
+  (path, handle) <- openBinaryTempFile tmpDir "ntfs-volume-test.img"
+  let record = BS.replicate 1024 0xaa
+      check = do
+        BS.hPut handle bootSector
+        hSeek handle AbsoluteSeek 16384
+        BS.hPut handle record
+        hFlush handle
+        opened <- openVolume handle
+        case opened of
+          Left _ -> pure False
+          Right volume -> do
+            bytes <- readMFTRecordBytes volume (MFTRef 0)
+            pure (mftOffset volume == 16384 && bytes == Right record)
+  check `finally` (hClose handle >> removeFile path)
+
+testMFTRecord :: Bool
+testMFTRecord =
+  case parseMFTRecord 512 mftRecordFixture of
+    Right record ->
+      recordNumber record == 9
+        && recordSequenceNumber record == 5
+        && recordHardLinkCount record == 2
+        && recordFirstAttributeOffset record == 0x38
+        && recordFlags record == 3
+        && recordUsedSize record == 0x70
+        && recordAllocatedSize record == 0x400
+        && recordBaseRecord record == MFTRef 0x1234
+        && recordNextAttributeId record == 7
+        && isRecordInUse record
+        && isDirectoryRecord record
+        && map rawAttributeType (recordAttributes record) == [0x10, 0x30]
+        && map (BS.length . rawAttributeBytes) (recordAttributes record) == [0x18, 0x18]
+        && BS.index (recordBytes record) 510 == 0x11
+        && BS.index (recordBytes record) 511 == 0x11
+        && BS.index (recordBytes record) 1022 == 0x22
+        && BS.index (recordBytes record) 1023 == 0x22
+    Left _ -> False
+
+testBadFixup :: Bool
+testBadFixup =
+  case parseMFTRecord 512 (putAt 510 (word16Bytes 0xffff) mftRecordFixture) of
+    Left _  -> True
+    Right _ -> False
+
+bootSector :: BS.ByteString
+bootSector =
+  build
+    (BS.replicate bootSectorSize 0)
+    [ (0x00, [0x00, 0x00, 0x00])
+    , (0x03, [0x4e, 0x54, 0x46, 0x53])
+    , (0x0b, word16Bytes 512)
+    , (0x0d, [0x08])
+    , (0x30, word64Bytes 4)
+    , (0x40, [0xf6])
+    , (0x44, [0xf7])
+    , (0x48, word64Bytes 0x1234)
+    , (0x1fe, [0x55, 0xaa])
+    ]
+
+mftRecordFixture :: BS.ByteString
+mftRecordFixture =
+  build
+    (BS.replicate 1024 0)
+    [ (0x00, [0x46, 0x49, 0x4c, 0x45])
+    , (0x04, word16Bytes 0x30)
+    , (0x06, word16Bytes 3)
+    , (0x10, word16Bytes 5)
+    , (0x12, word16Bytes 2)
+    , (0x14, word16Bytes 0x38)
+    , (0x16, word16Bytes 3)
+    , (0x18, word32Bytes 0x70)
+    , (0x1c, word32Bytes 0x400)
+    , (0x20, word64Bytes 0x1234)
+    , (0x28, word16Bytes 7)
+    , (0x2c, word32Bytes 9)
+    , (0x30, word16Bytes 0xaa55)
+    , (0x32, word16Bytes 0x1111)
+    , (0x34, word16Bytes 0x2222)
+    , (0x38, word32Bytes 0x10 ++ word32Bytes 0x18)
+    , (0x50, word32Bytes 0x30 ++ word32Bytes 0x18)
+    , (0x68, word32Bytes 0xffffffff)
+    , (0x1fe, word16Bytes 0xaa55)
+    , (0x3fe, word16Bytes 0xaa55)
+    ]
+
+build :: BS.ByteString -> [(Int, [Word8])] -> BS.ByteString
+build = foldl (\bytes (offset, xs) -> putAt offset xs bytes)
+
+putAt :: Int -> [Word8] -> BS.ByteString -> BS.ByteString
+putAt offset xs bytes =
+  BS.take offset bytes <> BS.pack xs <> BS.drop (offset + length xs) bytes
+
+word16Bytes :: Word16 -> [Word8]
+word16Bytes value =
+  [fromIntegral value, fromIntegral (value `shiftR` 8)]
+
+word32Bytes :: Word32 -> [Word8]
+word32Bytes value =
+  [fromIntegral (value `shiftR` (8 * i)) | i <- [0 .. 3]]
+
+word64Bytes :: Word64 -> [Word8]
+word64Bytes value =
+  [fromIntegral (value `shiftR` (8 * i)) | i <- [0 .. 7]]
