Using disk upgrades

From PrgmrWiki
Revision as of 02:58, 19 September 2015 by Srn (talk | contribs) (Adding partition)


Before making any changes to your disk, we strongly recommend backing up any data you do not want to lose. Subject to availability, you may contact support to request either a disk snapshot, which may be taken while your server is running, or a full backup, which requires turning off your server. Both of these are on-site and for now are intended to only be available until you've started successfully using your additional disk space. Also if there's enough disk space, we could alternately make you an entirely new block device and let you copy over the files if its too complicated to modify the existing disk (possibly this is the case if you're running NetBSD.)


There are two possible ways to use the additional disk space. One is to expand one of the partitions, the other is to add another partition. For both, you will probably need to boot into the rescue image. Log into the management console and select option 1

out of band console (press ctrl-] to escape, not resizeable)


Reboot from within the server and at

    GNU GRUB  version 0.97  (131072K lower / 0K upper memory)

 | user bootloader configuration                                           |  
 | Debian GNU/Linux, kernel 3.2.0-4-amd64 Live Rescue                      |
 | Debian GNU/Linux, kernel 3.2.0-4-amd64 (single-user mode) Live Rescue   |
 | ubuntu-trusty-14.04-64 rescue                                           |
 | ubuntu-trusty-14.04-64 install                                          |
 | centos5-64 rescue                                                       |
 | centos5-64 install                                                      |
 | debian-wheezy-7.0-64 rescue                                             |
 | debian-wheezy-7.0-64 install                                            |
 | fedora20-64 rescue                                                      |
 | fedora20-64 install                                                     |
 | centos6-64 rescue                                                       | v
    Use the ^ and v keys to select which entry is highlighted.
    Press enter to boot the selected OS, 'e' to edit the
    commands before booting, or 'c' for a command-line.

Boot Debian GNU/Linux Live Rescue from GRUB.

Log in as root.

Expanding partition

Assuming you have the default of a single partition, run

parted /dev/xvda resizepart 1 100%

Reboot into your main file system instead of the rescue image. Next run

resize2fs /dev/xvda1

Adding partition

Use either 'fdisk /dev/xvda' or 'cfdisk /dev/xvda' to add a new partition. "cfdisk" has a graphical interface and is probably easiest to use. After adding the partition, format it as desired. This is a reasonable way to format the correct partition at the command line:

DEV=/dev/xvda2 #replace with 3 or 4 if needed
#check if this is blank partition
file -s $DEV #this should be found and not contain anything other than data
dd if=$DEV bs=512 count=1 | hexdump #blank will have output like
#1+0 records in
#1+0 records out
#512 bytes (512 B) copied, 0.000491492 s, 1.0 MB/s
#0000000 0000 0000 0000 0000 0000 0000 0000 0000
mkfs -t ext3 $DEV

Decide where to mount the new filesystem. If you need to copy over data, you will need to mount both at the same time. For example

mkdir /mnt/root
mkdir /mnt/new
mount /dev/xvda1 /mnt/root
mount /dev/xvda2 /mnt/new
tar cf - -C /mnt/root/new/mount/point . | tar xvf - -C /mnt/new

If you are running with selinux on (the default for centos and fedora,) you will probably need to relabel after boot. Run

touch /mnt/root/.autorelabel 

Next you need to add this new mount point to /etc/fstab. Use your favorite text editor to edit /mnt/root/etc/fstab (possibly making a backup first) to add something like

/dev/xvda2 /new/mount/point  ext3    defaults,errors=remount-ro,barrier=0 1 1

unmount devices and reboot

umount /mnt/root
umount /mnt/new #if needed

If there is an issue after reboot, you may have an error in /etc/fstab or you may have chosen a file system that is not compatible with your current kernel. If necessary, you can reformat the new partition while booted from your main file system and also if necessary, boot back into the rescue image to copy files over while they are not in use.


This is WIP. You can use the netbsd installer as a rescue image, see Booting the NetBSD installer. Please refer to The block device is 'xbd0d'.