Partitioning?

I am running opensuse on my linode and I purposely created the disk image smaller so I could create a separate partition for some other stuff. Then I realized that that sets the size of the "disk", not a root partition (So I can't access the free space). So, how do I create a disk image with free space inside for additional partitions?

12 Replies

Update: I tried creating a larger disk image, and then resizing the root partition. Unfortunately, there doesn't seem to be one. So I tried creating a /home partition from /dev/xvda, but yast says it can't be mounted because it's already in use by the system. So, now I have two "drives" (/dev/xvda and /dev/xvdb) and one partition (xvda1) that can't be mounted but is already in use? I am a little confused.

I am getting a more confused. How does partitioning, lvms, etc work on virtual machines? I am rather new at this…

After a little investigation, it looks like it's best to think of the "disk images" as partitions. But, one of the disk image file system types is "raw", which might let you work with it using fdisk/cfdisk/sfdisk inside the linode. But I didn't try that…

It's probably easiest to just treat each disk image in the linode panel as a partition. If you want to use lvm from within your linode, you'll need either an initrd or a small root filesystem image to set up lvm, and a raw image to act as the actual LVM PV. I wouldn't recommend trying to use traditional fdisk - LVM is more featureful.

I can't think of a good reason (although there may be one) to worry about partitioning within a Linode. Manipulating disk images at the "machine" (Web interface) level gives you all the advantages of LVM, and you have all the simplicity of basic file systems within the Linode.

I'd create all my filesystems via the Web interface. Okay, there's one exception: I've created one raw so that I could use reiserfs for a maildb store (a lot of small files). But still didn't bother to LVM-ize it, because all that's done outside the system.

How about this reason:

I want to have a Linode dual boot for comparison testing purposes. One image has CentOS, the other has Ubuntu – or different kernel versions, or whatever.

(I found this thread looking for my specific scenario, so it's not hypothetical)

I create an image for each OS and then a third image for a shared /home (or /opt) partition image where user data such as web pages, email, and deployments are kept, so they can be accessible from either OS image.

I haven't tried it yet, but my guess is that I can create an ext3 disk image and mount it on both profiles as /dev/xvdc (where /dev/xvdca is the OS and /dev/xvdb is the Swap). Does this make sense.?

I'd assume an /etc/fstab entry referencing /dev/xvdc needs created as well.

@fijiaaron:

I haven't tried it yet, but my guess is that I can create an ext3 disk image and mount it on both profiles as /dev/xvdc (where /dev/xvdca is the OS and /dev/xvdb is the Swap). Does this make sense.?
Yup. It works too.
@fijiaaron:

I'd assume an /etc/fstab entry referencing /dev/xvdc needs created as well.
Yup, just like you would if you just had a /home split off.

@Xan:

I can't think of a good reason (although there may be one) to worry about partitioning within a Linode. Manipulating disk images at the "machine" (Web interface) level gives you all the advantages of LVM, and you have all the simplicity of basic file systems within the Linode.

I'd create all my filesystems via the Web interface. Okay, there's one exception: I've created one raw so that I could use reiserfs for a maildb store (a lot of small files). But still didn't bother to LVM-ize it, because all that's done outside the system.
MMM something askew and your log's grow huge pretty good reason to have a /var/log

Web server, /var/www keeps web sources on their own slice, security for one

Database, /var/lib/mysql

There are a number of reasons for both security and stability. Keeping everying on one slice especially for a server is foolish.

Marcus: those are all good reasons to have separate disk images, but with linodes that's the easiest way to handle it: disk images in the CP, and I can't think of why trying to partition a disk image would be better.

@SteveG:

Marcus: those are all good reasons to have separate disk images, but with linodes that's the easiest way to handle it: disk images in the CP, and I can't think of why trying to partition a disk image would be better.
You can change partitions live and utilise them without needing a reboot; disk images require rebooting to make active.

I tried it and it worked, with one snag related to my particular issue: with a shared home directory between Ubuntu and CentOS, the users have different UIDs and GIDs (starting with 500 on CentOS/Fedora and 1000 on Ubuntu) so I needed to change the UID to 1000 on Fedora, and will need to maintain /etc/passwd and /etc/groups for additional shared users.

@sweh:

You can change partitions live and utilise them without needing a reboot; disk images require rebooting to make active.

Only if none of the partitions on the disk are in use at the time you change the partitioning - if they are, you'll get a message saying that the kernel still uses the old partition table and that you'll need to reboot it to use the new one.

(Of course, if you LVM-ise it, you don't have this problem, so you can ignore this post in that case.)

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