Allocate Additionally Ordered Hard Disk Space to the Dynamic Cloud Server

Please Note:

The text on this page was translated by translation software. A revised version from our editors will be available soon.

For Dynamic Cloud Server

You can book additional storage space for your Dynamic Cloud Server at any time. However, it is then necessary to adjust the partitioning of the server. These instructions will show you how to do this.

Please note: This article assumes that you have already booked the storage space via your 1&1 IONOS and that it is available.

If you are now considering reinitializing your server - or have already done so - the following steps are not necessary, since partitioning is automatically adjusted during installation.

In the example underlying this guide, we have increased the server's storage space from 100 GB to 300 GB. However, the scope of enlargement has no influence on the approach.

inauguration

The storage space of your Dynamic Cloud Server is managed by the Logical Volume Manager (LVM). The LVM allows easy management of dynamically changeable partitions, so-called locigal volumes. Their size can be changed at any time, even if data has already been stored in them.

This manual will guide you through the following steps:

  • Displaying the partitioning
  • Deleting and creating a new LVM partition
  • Allocation of the booked storage space

View the current partitioning

Step 1

Log Dynamic Cloud Server in to yours via SSH.

Step 2

Type fdisk -l.

fdisk -l
Disk /dev/xvda: 300.0 GB 300001787904 bytes
255 heads, 63 sectors/track, 36473 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xad26f793


     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    12157    91345590   8e   Linux LVM  

On the top left you see the name and size of the mounted drive. In this example, it is /dev/xvda with a size of 300 GB. If you can still see the old size here, please wait a few minutes and then repeat the process.

You will also see that there is a /dev/xvda3 partition of type Linux LVM. In the next steps we will show you how to adapt them to the extended environment.

Deleting and creating a new LVM partition

You can manage your partitions with the partition program fdisk available in the basic installation.

Step 1

Log Dynamic Cloud Server in to yours via SSH.

Step 2

Type fdisk followed by the drive name. In this example, the command is fdisk /dev/xvda.

Please note: The name of the hard disk may vary depending on the file system and operating system. For the information relevant to you, see step 2.

fdisk /dev/xvda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended
to switch off the mode (command 'c') and change display units to
sectors (command 'u')

Command (m for help):

Fdisk will now ask for an input. Just type p for print here. Now you see a similar output as before with fdisk -l . Again you can see the Linux LVM partition.

Command (m for help): p
Disk /dev/xvda: 300.0 GB, 300001787904 bytes
255 heads, 63 sectors/track, 36473 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 / 512 bytes
Disk identifier 0xad26f793

     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    12157    91345590   8e   Linux LVM  

Command (m for help)

We will delete and recreate this Linux LVM partition in the next steps.

step 3

Enter d for delete to start the dialog for deleting a partition. Fdisk will ask you for the partition number. In this example, this is number 3.

Please note: The data will not be deleted! If you think you are doing something wrong, you can always leave fdisk with q for quit.

     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    12157    91345590   8e   Linux LVM  

Command (m for help): d
Partition number (1-4): 3

Command (m for help):

By entering p you can make sure that the partition has been deleted. The output should now be similar to this image.

Command (m for help): p

Disk /dev/xvda: 300.0 GB, 300001787904 bytes
255 heads, 63 sectors/track, 36473 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 / 512 bytes
Disk identifier 0xad26f793

     Device Boot         Start        End      Blocks   ID   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris

Command (m for help)
Step 4

Now create a new partition.

Choose the command n for new and then p for primary partition. For the cylinders, simply accept the default values by pressing Enter twice.

     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (786-36473, default 786):
Using default value 786
Last cylinder, +cylinders or +size{K,M,G}  (786-36473, default 36473):
Using default value 36473

Command (m for help)

Then select p again to display the partitions. Now you should see the new Linux partition.

Command (m for help): p

Disk /dev/xvda: 300.0 GB 300001787904 bytes
255 heads, 63 sectors/track, 36473 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xad26f793


     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    36473   286663860   83   Linux 

Command (m for help):
Step 5

Afterwards it is necessary to change the partition type to Linux LVM. Type t for type. Select the third partition again by typing in a 3. Now enter 8e for the Linux LVM type. Now you should get an output similar to the following:

     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    36473   286663860   83   Linux

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help):

When checking with p, the third partition should be entered as Linux LVM again.

     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    36473   286663860   8e   Linux LVM

Command (m for help):
Step 6

Finally, you must tell fdisk to write the changes to the partition table. You do this with the command w for write. Fdisk is also terminated. You now receive the message that the changes are only accepted after a restart.

     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    36473   286663860   8e   Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@s16131863 ~]#
Step 7

Now restart the server using shutdown -r now. Wait a few minutes and then log on to the server again using the SSH shell.

[root@s16131863 ~]# shutdown -r now
Broadcast message from root@s16131863.onlinehome-server.info
        (/dev/pts/0) at 17:52 ...

The system is going down for reboot NOW!
[root@s16131863 ~]# 
Step 8

Check partitioning again using fdisk -l.

[root@s16131863 ~]# fdisk -l

Disk /dev/xvda: 300.0 GB, 300001787904 bytes
255 heads, 63 sectors/track, 36473 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 / 512 bytes
Disk identifier 0xad26f793

     Device Boot         Start        End      Blocks   Id   System
/dev/xvda1                   1        523     4200966   83   Linux
/dev/xvda2                   524      785     2104515   82   Linux swap / Solaris
/dev/xvda3                   786    12157    91345590   8e   Linux LVM  

Type pvs to check the physical volume size. The value should not have changed.

[root@s16131863 ~]# pvs
  PV         VG   Fmt  Attr  PSize   PFree
  /dev/xvda3 vg00 lvm2 a--   87.11g  75.11g
[root@s16131863 ~]#

In the next step, we show you how to adjust the size of the logical volume.

Enlarge Logical Volume

After creating the LVM partition, the additional space must now be allocated to the volume.

Step 1

Now enter pvresize /dev/xvda3 in the shell to resize the volume. The output should look like this:

[root@s16131863 ~]# pvresize /dev/xvda3
  Physical volume "/dev/xvda3" changed
  1 physical volume (s) resized / 0 physical volume(s) not resized
Step 2

Check the result with pvs, the value PSize should now be a little smaller than displayed under fdisk.

[root@s16131863 ~]# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/xvda3 vg00 lvm2 a--  273.38g 261.38g