Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11904

Preallocated files are sparse in FreeBSD/UFS

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Environment:
      FreeBSD 9.1/9.2 amd64, mongodb 2.4.8
    • FreeBSD
    • Hide

      Reproducible with clean installation of FreeBSD + mongo

      Show
      Reproducible with clean installation of FreeBSD + mongo

      Title is clear, allocating 2GB files takes no time / no space on disk, and thus disk fragmentation can occur.

      # mkdir /tmp/x
      # mongod --dbpath /tmp/x --port 27111 --replSet rs1 --oplogSize 10000
      # mongo --port 27111
      > rs.initiate()
      
      Sat Nov 30 08:02:11.712 [FileAllocator] allocating new datafile x/local.1, filling with zeroes...
      Sat Nov 30 08:02:11.796 [FileAllocator] done allocating datafile x/local.1, size: 2047MB,  took 0.084 secs
      Sat Nov 30 08:02:11.797 [FileAllocator] allocating new datafile x/local.2, filling with zeroes...
      Sat Nov 30 08:02:11.801 [FileAllocator] done allocating datafile x/local.2, size: 2047MB,  took 0.004 secs
      Sat Nov 30 08:02:11.801 [FileAllocator] allocating new datafile x/local.3, filling with zeroes...
      Sat Nov 30 08:02:11.805 [FileAllocator] done allocating datafile x/local.3, size: 2047MB,  took 0.003 secs
      Sat Nov 30 08:02:11.805 [FileAllocator] allocating new datafile x/local.4, filling with zeroes...
      Sat Nov 30 08:02:11.810 [FileAllocator] done allocating datafile x/local.4, size: 2047MB,  took 0.005 secs
      Sat Nov 30 08:02:11.811 [FileAllocator] allocating new datafile x/local.5, filling with zeroes...
      Sat Nov 30 08:02:11.815 [FileAllocator] done allocating datafile x/local.5, size: 2047MB,  took 0.004 secs
      
      # ll -h
      total 1032
      drwxr-xr-x  2 root  wheel   512B Nov 30 08:02 _tmp/
      drwxr-xr-x  2 root  wheel   512B Nov 30 08:04 journal/
      -rw-------  1 root  wheel    64M Nov 30 08:02 local.0
      -rw-------  1 root  wheel     2G Nov 30 08:02 local.1
      -rw-------  1 root  wheel     2G Nov 30 08:02 local.2
      -rw-------  1 root  wheel     2G Nov 30 08:02 local.3
      -rw-------  1 root  wheel     2G Nov 30 08:02 local.4
      -rw-------  1 root  wheel     2G Nov 30 08:02 local.5
      -rw-------  1 root  wheel    16M Nov 30 08:02 local.ns
      -rwxr-xr-x  1 root  wheel     0B Nov 30 08:04 mongod.lock*
      # du -sh
      1.0M    .
      

            Assignee:
            davide.italiano Davide Italiano
            Reporter:
            taha_jahangir Taha Jahangir
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: