Difference between revisions of "Using disk upgrades"
|Line 57:||Line 57:|
Reboot into your main file system instead of the rescue image.
Reboot into your main file system instead of the rescue image. run
Revision as of 03:27, 19 September 2015
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 it's too complicated to modify the existing disk (possibly this is the case if you're running NetBSD.)
There are two typical 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.
Debian GNU/Linux Live Rescue from GRUB.
Log in as root.
sfdisk -d /dev/xvda
You will get output like
# partition table of /dev/xvda unit: sectors /dev/xvda1 : start= 8192, size= 25157632, Id=83 /dev/xvda2 : start= 0, size= 0, Id= 0 /dev/xvda3 : start= 0, size= 0, Id= 0 /dev/xvda4 : start= 0, size= 0, Id= 0
Take this output and copy it somewhere outside of your server. Should you need to undo any changes to your partition table, it can be used to restore your original partition table by using it as input to 'sfdisk --force /dev/xvda'.
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. For an ext-based file system (the default) run
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 #* #0000200 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 copying data, when you are satisfied the data has been copied correctly, you can remove the old copies of the files from /mnt/root/new/mount/point. You will need to do this before rebooting as otherwise the new partition will be mounted over the old files and there will be no way to access them.
If you are running with selinux on (the default for centos and fedora,) you will probably need to relabel after boot. Run
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 reboot
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 https://www.netbsd.org/docs/guide/en/chap-misc.html#chap-misc-adding-new-disk. The block device is 'xbd0d'.