How to allocate disks is using "Gold Master" image?

I have a 48 GB Debian 7.4 server that I want to upgrade to Debian 8. My current Debian profile is configured so that I have one "Debian 7.4 Disk Image" that uses 48896 MB and one "256 MB Swap Image". Everything is installed on the Debian disk image. What I'd like to start doing is setting up and saving a "Gold Master" disk image that just contains my current Debian distro. I would then update my Debian profile so that it uses three disk images instead of the current two: a 1 GB (size) copy of my gold master that just contains Debian OS (call it "root"), my (256 MB) swap disk, and a third disk image ("call it "system") that uses up my remaining disk space allotment. Am I correct in thinking that I need a third separate "root" disk that just contains a copy of my gold master if I'm going to use a gold master? I think I need to do this since gold master images are limited in size to 2 GB and my current Debian disk is 48 GB.

My goal is to always have a gold master that contains just the current Debian release. Anytime I need to upgrade to a new major Debian release, I'd create a new gold master that contains it. I could then delete my big "system" disk and re-install all my packages on it using a CM.

Is this the correct approach when using a gold master disk image? Thanks.

3 Replies

Just as an update, I did what I described in my question but now I have another problem. Here's what I have now:

1. "Debian 8.1 Disk Image" having a size of 1024 MB.

2. "256 MB Swap Image"

3. "Debian Filesystem Disk Image" having a size of 47060 MB (all my remaining disk space)

I assigned this last image to /dev/xvdc in my configuration profile. The problem is that when the system boots, I don't see the space from the filesystem disk image. I'm sure the reason is because I didn't give it an entry in the /etc/fstab file, but I didn't create an entry since I don't know what to call the mount point. I think the entry should look something like this:

proc /proc proc defaults 0 0

/dev/xvda / ext4 noatime,errors=remount-ro 0 1

/dev/xvdb none swap sw

/dev/xvdc /??? ext4 noatime,errors=remount-ro 0 2 <== What should ??? be?

What should I call /??? It's not /home or /usr or /var because this disk should be containing all those things. I think I'm doing this all wrong. :-(

To answer my own question, I think what I would now need to do is create separate disk images for whatever partitions I choose and then add a mount point for each one in fstab. However, this seems to go against what a lot of people seem to do here which is dump everything in one large partition.

Thanks.

@rlfprog:

I assigned this last image to /dev/xvdc in my configuration profile. The problem is that when the system boots, I don't see the space from the filesystem disk image. I'm sure the reason is because I didn't give it an entry in the /etc/fstab file (…)
That's correct. As long as you have it defined in your configuration profile you can still manually mount it at any time, but it won't be done automatically without the fstab entry.

> What should I call /??? It's not /home or /usr or /var because this disk should be containing all those things. I think I'm doing this all wrong. :-(
Well, the short answer is call /??? anything you want - you can mount the new partition anywhere (and at any depth). As for doing this all wrong, while the approach you're taking isn't "wrong" per-se (there's no one "right" way) it may or may not map well to how you anticipate using the space.

The available space in the partition will exist completely beneath whatever mount point you choose, so it sort of depends on how you will structure your directories on the system. There's certainly nothing wrong with mounting it on /home(*) if you like and will tend to use a lot of space for your home directories. Over time I've also found myself liking /srv to hold my partitions, either as /srv/machine for machine based trees, or /srv/service for service-related files.

Assuming you aren't going to split /usr or /var from your root partition, you may or may not find that you will want to allocate a bit more space there for possible future growth (you can resize the disk image after initially creating it from your gold master).

Of course, wherever you mount the partition, you can always link other locations beneath it distributing the space across the rest of the filesystem as needed, with some increase in complexity to manage things. It mostly comes down to what you meant by a "system" third disk image using up the remaining disk space in your original post. What did you anticipate using up the space with and where in the filesystem would you anticipate needing that space?

(*) Just be aware that when mounting over places like /home, if you have pre-existing content there in your root partition it will be hidden when the new partition is mounted over it. So first mount your new partition on a temporary folder, transfer over any existing /home content, and then re-mount the new partition over /home. Same holds true for any other pre-existing mount point.

> To answer my own question, I think what I would now need to do is create separate disk images for whatever partitions I choose and then add a mount point for each one in fstab. However, this seems to go against what a lot of people seem to do here which is dump everything in one large partition.
A single partition certainly avoids any of the questions being raised here, so it has that simplicity going for it. But yes, a finer grained approach to partitions is an entirely valid choice as well. It's what I use myself, for example.

I'm not positive what the majority behavior is for sure, though it wouldn't surprise me if it were in fact single partition systems - if only due to it being the default behavior, and a bit simpler in terms of less to think about (if arguably also less flexible). It's also true (and as you originally noted) that with the increasing use of configuration tools, it's simpler to just create a new node from scratch and not worry so much about separation of concerns at the filesystem level. But it's certainly not the only valid approach.

For my part, I tend to have root, swap, home, and one or more srv images. The root image is mounted on /, home on /home and my srv images on /srv/xxx depending on their purpose. I don't tend to use my full disk allocation up front, but allocate what I need as I need it, leaving room to grow or add additional images if needed. Among other things it lets me reuse my home and srv images with different root/distribution partitions during upgrade testing, and srv images can be cloned between servers offering the same services if needed. It also helps protect against exhaustion - for example my database servers have separate partitions for the actual database storage from regular system and user files, so sudden growth in the latter can't possibly exhaust the space for the database (one of the classic reasons for partitioning a *nix system).

But there's really no "right" or "wrong" way - it's whatever works better for your use case and/or personal preferences. And if in the end you find yourself preferring the single partition approach, you can still use your gold master - just build your image from it and then immediately grow the image to your available space.

– David

David, thank you very much for your detailed answer. If it were up to me, I'd pin this question as it's probably a pretty common one for new Linode users.

As this is my first public web server, I'm not sure how much room I'll need. I do plan to have separate database and static media servers so I doubt I'll need all of it. As I like to start by doing the simplest thing first, I think I'll create a minimal boot image, save it as a "gold master", resize it during the provisioning process and start out with a single large disk (in addition to swap) that uses all my allotted space. In keeping with your idea of not using all my allotted space, I'll then re-provision the server, load my website and all its required packages, and see how much room I actually need. I can then rebuild the disk again but make it smaller (after adding some room for my logs) and thus leave myself some extra space for future use. When I've gone into production and can see how much space I'm actually using, I can revisit the idea of creating separate partitions.

Thanks again for taking the time to respond.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct