|
|
Line 43: |
Line 43: |
|
| |
|
| ==Formatting and Mounting an Empty Volume== | | ==Formatting and Mounting an Empty Volume== |
| On most Linux distributions the following steps can be used to partition, format, and mount the newly created volume. NOTE: If this is not a newly created volume the partition and format steps should be skipped as they will result in loss of data on that volume, and only the steps to mount the volume should be followed.
| | Before a newly created and attached volume can be used it must be formatted and mounted. See instructions for doing this on a [[Using a new empty volume on a Linux VM|Linux]] or [[Using a new empty volume on a Windows VM|Windows]] VM. |
| | |
| <ol>
| |
| <li>Create a partition on the volume with
| |
| {{Command|sudo fdisk /dev/vdb}}
| |
| <code>fdisk</code> will prompt you to enter a command. Use this sequence of single-character commands to create a new partition on your volume.</li>
| |
| | |
| n => new partition
| |
| p => primary, only one partition on disk
| |
| 1 => partition number 1
| |
| <return> => first sector (use default)
| |
| <return> => last sector (use default)
| |
| w => write partition table to disk and exit
| |
| | |
| <li>Format the newly created partition with
| |
| {{Command|sudo mkfs -t ext4 /dev/vdb1}}
| |
| <li>Create a place to mount the device with
| |
| {{Command|sudo mkdir /media/data}}
| |
| <li>Finally, mount the volume with
| |
| {{Command|sudo mount /dev/vdb1 /media/data}}
| |
| </ol>
| |
| | |
| If the VM is rebooted for some reason the volume will need to be remounted. To cause the VM to mount the volume automatically at boot time, edit <code>/etc/fstab</code> and add a line like
| |
| | |
| /dev/vdb1 /media/data ext4 defaults 0 2
| |
| | |
| For more details about the fstab file see this [https://en.wikipedia.org/wiki/Fstab wikipedia article]. If you are not rebooting, you can mount the device just added to <code>/etc/fstab</code> with
| |
| {{Command|sudo mount -a}}
| |
|
| |
|
| ==Booting from a Volume== | | ==Booting from a Volume== |