github.com/slene/docker@v1.8.0-rc1/docs/articles/b2d_volume_resize.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Resizing a Boot2Docker volume	"
     4  description = "Resizing a Boot2Docker volume in VirtualBox with GParted"
     5  keywords = ["boot2docker, volume,  virtualbox"]
     6  [menu.main]
     7  parent = "smn_win_osx"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # Getting “no space left on device” errors with Boot2Docker?
    12  
    13  If you're using Boot2Docker with a large number of images, or the images you're
    14  working with are very large, your pulls might start failing with "no space left
    15  on device" errors when the Boot2Docker volume fills up. There are two solutions
    16  you can try.
    17  
    18  ## Solution 1: Add the `DiskImage` property in boot2docker profile
    19  
    20  The `boot2docker` command reads its configuration from the `$BOOT2DOCKER_PROFILE` if set, or `$BOOT2DOCKER_DIR/profile` or `$HOME/.boot2docker/profile` (on Windows this is `%USERPROFILE%/.boot2docker/profile`).
    21  
    22  1. View the existing configuration, use the `boot2docker config` command.
    23  
    24          $ boot2docker config
    25          # boot2docker profile filename: /Users/mary/.boot2docker/profile
    26          Init = false
    27          Verbose = false
    28          Driver = "virtualbox"
    29          Clobber = true
    30          ForceUpgradeDownload = false
    31          SSH = "ssh"
    32          SSHGen = "ssh-keygen"
    33          SSHKey = "/Users/mary/.ssh/id_boot2docker"
    34          VM = "boot2docker-vm"
    35          Dir = "/Users/mary/.boot2docker"
    36          ISOURL = "https://api.github.com/repos/boot2docker/boot2docker/releases"
    37          ISO = "/Users/mary/.boot2docker/boot2docker.iso"
    38          DiskSize = 20000
    39          Memory = 2048
    40          CPUs = 8
    41          SSHPort = 2022
    42          DockerPort = 0
    43          HostIP = "192.168.59.3"
    44          DHCPIP = "192.168.59.99"
    45          NetMask = [255, 255, 255, 0]
    46          LowerIP = "192.168.59.103"
    47          UpperIP = "192.168.59.254"
    48          DHCPEnabled = true
    49          Serial = false
    50          SerialFile = "/Users/mary/.boot2docker/boot2docker-vm.sock"
    51          Waittime = 300
    52          Retries = 75
    53  
    54    The configuration shows you where `boot2docker` is looking for the `profile` file. It also output the settings that are in use.
    55  
    56  
    57  2. Initialise a default file to customize using `boot2docker config > ~/.boot2docker/profile` command.
    58  
    59  3. Add the following lines to `$HOME/.boot2docker/profile`:
    60  
    61          # Disk image size in MB
    62          DiskSize = 50000
    63  
    64  4. Run the following sequence of commands to restart Boot2Docker with the new settings.
    65  
    66          $ boot2docker poweroff
    67          $ boot2docker destroy
    68          $ boot2docker init
    69          $ boot2docker up
    70  
    71  ## Solution 2: Increase the size of boot2docker volume
    72  
    73  This solution increases the volume size by first cloning it, then resizing it
    74  using a disk partitioning tool. We recommend
    75  [GParted](http://gparted.sourceforge.net/download.php/index.php). The tool comes
    76  as a bootable ISO, is a free download, and works well with VirtualBox.
    77  
    78  1. Stop Boot2Docker
    79  
    80    Issue the command to stop the Boot2Docker VM on the command line:
    81  
    82        $ boot2docker stop
    83  
    84  2. Clone the VMDK image to a VDI image
    85  
    86    Boot2Docker ships with a VMDK image, which can't be resized by VirtualBox's
    87    native tools. We will instead create a VDI volume and clone the VMDK volume to
    88    it.
    89  
    90  3. Using the command line VirtualBox tools, clone the VMDK image to a VDI image:
    91  
    92          $ vboxmanage clonehd /full/path/to/boot2docker-hd.vmdk /full/path/to/<newVDIimage>.vdi --format VDI --variant Standard
    93  
    94  4. Resize the VDI volume
    95  
    96    Choose a size that will be appropriate for your needs. If you're spinning up a
    97    lot of containers, or your containers are particularly large, larger will be
    98    better:
    99  
   100        $ vboxmanage modifyhd /full/path/to/<newVDIimage>.vdi --resize <size in MB>
   101  
   102  5. Download a disk partitioning tool ISO
   103  
   104    To resize the volume, we'll use [GParted](http://gparted.sourceforge.net/download.php/).
   105    Once you've downloaded the tool, add the ISO to the Boot2Docker VM IDE bus.
   106    You might need to create the bus before you can add the ISO.
   107  
   108    > **Note:**
   109    > It's important that you choose a partitioning tool that is available as an ISO so
   110    > that the Boot2Docker VM can be booted with it.
   111  
   112    <table>
   113        <tr>
   114            <td><img src="/articles/b2d_volume_images/add_new_controller.png"><br><br></td>
   115        </tr>
   116        <tr>
   117            <td><img src="/articles/b2d_volume_images/add_cd.png"></td>
   118        </tr>
   119    </table>
   120  
   121  6. Add the new VDI image
   122  
   123    In the settings for the Boot2Docker image in VirtualBox, remove the VMDK image
   124    from the SATA controller and add the VDI image.
   125  
   126    <img src="/articles/b2d_volume_images/add_volume.png">
   127  
   128  7. Verify the boot order
   129  
   130      In the **System** settings for the Boot2Docker VM, make sure that **CD/DVD** is
   131      at the top of the **Boot Order** list.
   132  
   133      <img src="/articles/b2d_volume_images/boot_order.png">
   134  
   135  8. Boot to the disk partitioning ISO
   136  
   137    Manually start the Boot2Docker VM in VirtualBox, and the disk partitioning ISO
   138    should start up. Using GParted, choose the **GParted Live (default settings)**
   139    option. Choose the default keyboard, language, and XWindows settings, and the
   140    GParted tool will start up and display the VDI volume you created. Right click
   141    on the VDI and choose **Resize/Move**.
   142  
   143    <img src="/articles/b2d_volume_images/gparted.png">
   144  
   145  9. Drag the slider representing the volume to the maximum available size.
   146  
   147  10. Click **Resize/Move** followed by **Apply**.
   148  
   149    <img src="/articles/b2d_volume_images/gparted2.png">
   150  
   151  11. Quit GParted and shut down the VM.
   152  
   153  12. Remove the GParted ISO from the IDE controller for the Boot2Docker VM in
   154  VirtualBox.
   155  
   156  13. Start the Boot2Docker VM
   157  
   158    Fire up the Boot2Docker VM manually in VirtualBox. The VM should log in
   159    automatically, but if it doesn't, the credentials are `docker/tcuser`. Using
   160    the `df -h` command, verify that your changes took effect.
   161  
   162    <img src="/articles/b2d_volume_images/verify.png">
   163  
   164  You're done!