Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 
Cloud Server > 3 - Creating and Configuring a Cloud Server > Partitioning and formatting an added hard drive (Linux)

3.08.2 Partitioning and formatting an added hard drive (Linux) Cloud Server Pro service guide

To partition and format an additional hard drive on a Cloud Server with a Linux operating system, proceed as follows:

(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start  End  Size Type  File system  Flags

(parted) mkpart
Partition type?  primary/extended? primary
File system type?  [ext2]? ext3
Start? 1
End? 21.5GB

(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type    File system  Flags
 1      1049kB 21.5GB  21.5GB  primary ext3

# mkfs.ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621184 blocks
131059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
      32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

# /etc/fstab
# Created by anaconda on Mon May 21 09:51:28 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

/dev/mapper/vg-lv_root  /             ext4     defaults        1 1
UUID=880645ef-dfff-477d-92d3-886935289a74 /boot         ext4     defaults        1 2
/dev/mapper/vg-lv_swap  swap          swap     defaults        0 0
tmpfs                   /dev/shm      tmpfs    defaults        0 0
devpts                  /dev/pts      devpts   gid=5,mode=620  0 0
sysfs                   /sys          sysfs    defaults        0 0
proc                    /proc         proc     defaults        0 0
/dev/cdrom              /media/cdrom  iso9660  noauto,owner,ro 0 0
/dev/sdb1               /backup       ext3     defaults        1 1

  1. Access the Cloud Server via SSH.
  2. Once you have accessed it, type fdisk -l from the command line and press enter.
  3. The information will then be displayed on the disks installed and their partitions
  4. To identify the disk you have just added: it is usually located in the form /dev/sdb if it is the first disk added.
  5. Run the Parted utility from the command line for the disk that you wish to format: for example parted /dev/sdb and confirm by pressing the Enter key.
  6. Then you need to create a partition table by keying in the command mktable and pressing the Enter key. When asked what type of partition, type in Msdos and confirm by pressing the Enter key.
  7. Type print press enter to make sure that it will actually be in the new disk. In this case the type of model will be displayed, the maximum size will be shown and the partitions will be listed (in this case no partition as the disk has just been added).
  8. To create a new partition launch mkpart and respond to the various requests. First you are asked to choose the "type" between "primary" and "extended" (we will choose primary) then you are asked for the type of "File System" (for example we choose ext3 and confirm); then you will be asked for the start and the end of the partition (in our example, if we want to create a partition that corresponds with the physical size of the disk simply indicate the start with 1 and the end with 21.5 GB).
  9. At this point by re-launching print we can check whether the new partition 1 has been created.
  10. Now you just have to create the Filesystem in the created partition: first exit "parted" by typing quit and then launch mke2fs for the created partition (which in the example is: /dev/sdb1).
  11. To manage the information on a partition to mount it is possible to edit file /etc/fstab.
 The operations described have an exclusively exemplary nature: the improper use or use without due care and skill, can cause the partial and/or total loss of data, and in some cases may disrupt the correct operation of the virtual machine. Using this guide without the appropriate skills is not recommended. Aruba S.p.A. does not accept any responsibility for any problems or damage caused by using these guides.