• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Moving FOG's /images files off the root partition 2017 edition

    Scheduled Pinned Locked Moved
    Tutorials
    3
    7
    3.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • george1421G
      george1421 Moderator
      last edited by george1421

      Here is an updated tutorial that is related to this tutorial. https://forums.fogproject.org/topic/6642/moving-fog-s-images-files-off-the-root-partition

      Since that tutorial was written I’ve learned some new stuff and changed my opinion about how to go about protecting the root partition from uncontrolled growth. The goal is still to go about moving the uncontrolled files off the root partition, but now with virtual servers its easier to grow virtual disks if/when addition space is needed. The following is how I go about doing this today.

      currently under constructions

      Part 1 Steps to take if FOG is not installed (easier process)

      1. If you are using Ubuntu or other OS that utilize sudo exclusivly you may want to issue the following command to become root. This command gives you roughly the same power as disabling UAC on windows, so be wise about how you use it. sudo su -i Then enter your password. From now on, you are in “god mode”, so behave your self.
      2. Add a new virtual hard drive to the server. Size this new vmdk file appropriately for the number of images you plan on capturing. For my installation I make this new vmdk file 100GB in size.
      3. Reboot the server to sync the OS
      4. Now we need to locate this new drive. Since this is the second hard drive in the system it would probably be defined as /dev/sdb. Issue the lsblk command to show you the drive structure.
      lsblk
      NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
      sda      8:0    0 298.1G  0 disk 
      ├─sda1   8:1    0 294.3G  0 part /
      ├─sda2   8:2    0     1K  0 part 
      └─sda5   8:5    0   3.8G  0 part [SWAP]
      sdb      8:16    0 100.0G  0 disk 
      
      1. Now that we know our 100GB disk is sdb connected. Lets start to provision the disk.
      2. We’ll use fdisk to create a new partition on our new disk. This partition will consume the entire new virtual hard drive. I’m going to give the commands rapid fire here. Please look up the fdisk utility to understand exactly what each command will do. Make absolute sure you know which disk is your new disk, because there is a risk you could wipe out your fog server OS disk if you are just parroting commands.
      # fdisk /dev/sdb
      n
      p
      <enter 3 time>
      w
      
      1. With the physical partition created we can now format the disk. In this case I’m formatting the disk in the ext4 format. Remember to select the first partition on the new disk (sdb).
        mkfs.ext4 /dev/sdb1
      2. Next we will create a directory where we can mount this new disk. Key in the following commands.
        mkdir /opt/fogdisk
      3. Add the following line to your /etc/fstab file. This command will tell your linux OS to mount /dev/sdb1 on the /opt/fogdisk directory upon each reboot.
      /dev/sdb1 /opt/fogdisk ext4 defaults 0 1
      
      1. Save and exit the /etc/fstab file.
      2. With the fstab file updated, lets tell the OS to mount all, to test to ensure that our new drive is mounted on each reboot.
        mount -a
      3. Issue the df -h command to show you the mounted devices. You should see a line in the df output that looks similar to this:
        /dev/sdb1 99G 0G 99G 99% /opt/fogdisk
      4. Now we need to create a few directories FOG will use and remap them to the new disk we just mounted.
        mkdir /images
        mkdir /opt/fog
        mkdir /opt/fog/snapins
      5. Create the matching directories on our new disk.
        mkdir /opt/fogdisk/images
        mkdir /opt/fogdisk/snapins
      6. This is where the magic happens. We are going to use a special type of mount called a bind mount (MS Windows has a similar function called junction in NTFS).
      7. Lets update the /etc/fstab file again.
        Issue the df -h command to show you the mounted devices. You should see a line in the df output that looks similar to this:
        /dev/mapper/fog_disk-fog_files 99G 0G 99G 99% /opt
      /images /opt/fogdisk/images bind bind 0 0
      /opt/fog/snapins /opt/fogdisk/snapins bind bind 0 0
      /opt/fog/snapins /opt/fogdisk/snapins
      
      1. Save and exit /etc/fstab
      2. Run the mount command again to connect these bind directories.
        mount -a
      3. Now test to ensure that everything is setup properly. We are going to create a file in /images and /opt/fog/snapins and then verify the files were created on the new disk.
      4. First we’ll create our test files.
        touch /images/image.chk
        touch /opt/fog/snapins/snapin.chk
      5. List the directories to ensure the files are on the new disk.
        ls -la /opt/fogdisk/images
        ls -la /opt/fogdisk/snapins
      6. Both of the above ls commands should have displayed the *.chk file. If they did then the bind mount is working correctly.
      7. Lets clean up our check files since they are no longer needed.
        rm /images/image.chk
        rm /opt/fog/snapin.chk
      8. At this point you can install FOG normally. The disk environment is setup so that the FOG installer will think all of the storage is on the root partition.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      P 1 Reply Last reply Reply Quote 1
      • george1421G
        george1421 Moderator
        last edited by

        (place holder)

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

        1 Reply Last reply Reply Quote 0
        • george1421G
          george1421 Moderator
          last edited by

          (place holder)

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

          1 Reply Last reply Reply Quote 0
          • george1421G
            george1421 Moderator
            last edited by

            (place holder)

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

            1 Reply Last reply Reply Quote 0
            • george1421G
              george1421 Moderator
              last edited by george1421

              Part 2 Steps to take if FOG is already installed (bit more complicated process)

              do something else

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

              1 Reply Last reply Reply Quote 0
              • JGeearJ
                JGeear
                last edited by

                @george1421 said in Moving FOG's /images files off the root partition 2017 edition:

                touch /opt/fog/snapin.chk

                Tutorial worked like a charm! The is some minor errors as follows:

                The following line needs bind bind 0 0 added
                /opt/fog/snapins /opt/fogdisk/snapins bind bind 0 0

                and the Snapin test file needs to be in the right directory!
                touch /opt/fog/snapins/snapin.chk

                1 Reply Last reply Reply Quote 1
                • P
                  post14 @george1421
                  last edited by

                  @george1421 said in Moving FOG's /images files off the root partition 2017 edition:

                  /dev/mapper/fog_disk-fog_files 99G 0G 99G 99% /opt

                  At step 16, I do not get this printout from df -h as listed above. The directory /image and /snapin are linking to the /opt/fogdisk which is mapped to the new disk partition, but for some reason, the /opt/fogdisk/images and /snapin are mapped to the root partition. Any recommendations? Did I miss something?

                  When I run mount, I get the following:
                  /dev/xvdb1 on /opt/fogdisk type ext4 (rw,relatime)
                  /dev/mapper/ubuntu–vg–1-ubuntu–lv on /opt/fogdisk/images type ext4 (rw,relatime)
                  /dev/mapper/ubuntu–vg–1-ubuntu–lv on /opt/fogdisk/snapins type ext4 (rw,relatime)

                  1 Reply Last reply Reply Quote 0
                  • george1421G george1421 referenced this topic on
                  • 1 / 1
                  • First post
                    Last post

                  263

                  Online

                  12.0k

                  Users

                  17.3k

                  Topics

                  155.2k

                  Posts
                  Copyright © 2012-2024 FOG Project