• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

Preparing Data Disks on Linux Performance Cloud Servers


The data disks attached to some flavors of Performance Cloud Servers are unformatted when created. Before you can use them to hold data on Linux, they have to be prepared by formatting them, determining their mount points, and adding them to the system's fstab file.

The following is a guide to preparing data disks efficiently for standalone use. To configure two data disks in a software RAID, please see this guide.

  1. List the volumes attached to your server by running the fdisk command.

    sudo fdisk -l
    

    In the volume list, the device /dev/xvda is the system disk. Other volumes listed will be your data or Cloud Block Storage disks.

  2. To partition the disk, run the fdisk utility and specify the disk. Example Input: root@nosnetdfw:~# fdisk /dev/xvde

    Example Output: Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x59a4ec2c. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable.

    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    
    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): m
    Command action
    A. bootable flag
    B. edit bsd disklabel
    C. toggle the dos compatibility flag
    D. delete a partition
    E. list known partition types
    F. print this menu
    G. add a new partition
    H. create a new empty DOS partition table
    I. print the partition table
    J. quit without saving changes
    K. create a new empty Sun disklabel
    L. change a partition's system id
    M. change display/entry units
    N. verify the partition table
    O. write table to disk and exit
    P. extra functionality (experts only)
    
    Command (m for help):  
    
  3. Enter n to create a new partition.

    Example Input:

    Command (m for help): n
    

    Example Output:

    Command action
       e   extended
       p   primary partition (1-4)        
    
  4. Enter p to indicate a primary partition.

    Example Input:

    p
    

    Example Output:

    Partition number (1-4): 
    
  5. Because this is the first and only partition that you are creating on the volume, enter 1.

    Example Input:

    Partition number (1-4): 1
    

    Example Output:

    First cylinder (1-13054, default 1):  
    
  6. To accept the default start cylinder, which is 1, press Enter.

    Example Output:

    Using default value 1
    Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054): 
    
  7. Press Enter to select the last cylinder of the disk for the partition to use up the entire disk. The last partition is the default.

    Example Output:

    Using default value 13054
    
    Command (m for help):
    
  8. Enter w to write the partition.

    Example Input:

    Command (m for help): w
    

    Example Output:

    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.  
    
  9. List the disks on your server again. Your data disk is ready as a disk. It was attached at /dev/xvde and you created one partition on it, so now your available disk appears at /dev/xvde1.

    Example Input:

    root@nosnetdfw:~# fdisk -l
    

    Example Output:

    Disk /dev/xvda: 42.9 GB, 42949672960 bytes
    255 heads, 63 sectors/track, 5221 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: 0x000dc852
    
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvda1               1        5222    41942016   83  Linux
    
    Disk /dev/xvde: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 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: 0x59a4ec2c
    
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvde1               1       13054   104856223+  83  Linux
    
  10. Format the main partition of each attached data disk with the mkfs command.

    sudo mkfs -t ext3 /dev/xvde1
    

    Substitute the device and partition number for /dev/xvde1 in the example.

  11. Create mount points for each data disk as needed.

    Data disks must be assigned directories as mount points in order for the system to use them for storage. If a data disk is meant to hold a database, for example, its mount point should be the database's storage location (like /var/lib/mysql).

    If the directory you will assign a disk to doesn't already exist, create it with the mkdir command.

    sudo mkdir -p /path/to/directory
    
  12. Assign disks to mount points by adding them to the /etc/fstab file.

    Edit the file with your favorite text editor, as in:

    sudo nano /etc/fstab
    

    Add a line for each disk listing its device name and partition number with the directory to mount it to, following this format:

    /dev/xvde1          /var/lib/mysql  ext3    defaults,noatime,nofail      0      2
    
  13. Mount any new drives by running the mount command.
    sudo mount -a

  14. Confirm that the data disks are mounted by running a disk space check.

    df -h
    

    If any disks are missing, check the configuration lines in /etc/fstab to make sure the device names and options are correct.







© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER