Windows host Ubuntu guess on VirtualBox
Add new virtual disks to Ubuntu
- Check your VM Ubuntu disks. Remember how many /dev/sd* disks it has
ls /dev/sd* | tee $HOME/my_sd1.log
- Turn off your VM Ubuntu
- Open Oracle VM Virtual Box Manager, select the Virtual Box for which you want to add the new disk and click on Settings.
- Click on Storage, select Controller (same with Ubuntu boot disk), click on Add hard disk icon.
- Choose Create New Disk.
- Hard disk type: VDI is my choice
- Storage on physical hard disk: Dynamically allocated
- File location and create: your choices. But you can create a 2 TB virtual disk only. You can repeat above steps to add more disks
- Now Start your VM Ubuntu
- Check your VM Ubuntu disks again. Check how many /dev/sd* disks it has
ls /dev/sd* | tee $HOME/my_sd2.log
- Example you have 2 new disks /dev/sdb and /dev/sdc
- Creating Linux Partitions
sudo fdisk /dev/sdb
# type c to switch off the DOS-compatible mode
# type u to change display units to sectors
# type n for new partition
# type p for primary partition
# type 1 for Partition number, your choice
# type w for to write all
- Do the same for /dev/sdc
- Check your VM Ubuntu disks again. You will have new /dev/sdb1 and /dev/sdc1
ls /dev/sd* | tee $HOME/my_sd3.log
- Format the Partitions
sudo mkfs.ext4 /dev/sdb1
sudo mkfs.ext4 /dev/sdc1
- Edit fstab by adding these lines
/dev/sdb1 /media/DATA1 ext4 rw 0 0
/dev/sdc1 /media/DATA2 ext4 rw 0 0
- Mount the new partitions
sudo mkdir /media/DATA1
sudo mkdir /media/DATA2
sudo mount -av
# Display information about file system disk space usage
df -h
Ref:
- https://www.vitalsofttech.com/add-disk-storage-to-oracle-virtualbox-with-linux/
- https://www.tutorialspoint.com/how-to-add-disk-storage-to-oracle-virtual-box-on-linux
Create a large partrition by combining 2 drives
Example you have created 2 virtual drives above. But you want a larger drive.
Caution - Data losss at /media/DATA1 and /media/DATA2
- Check your system status
# list Block Devices
sudo lsblk
# Display information about Physical Volumes
sudo pvs
# Display information about Volume Groups
sudo vgs
# Display information about Logical Volumes
sudo lvs
# Display information about file system disk space usage
df -h
- Unmount your drives
sudo umount /media/DATA1
sudo umount /media/DATA2
- Create two physical volumes
sudo pvcreate /dev/sdb1 /dev/sdc1
- Create one volume group name VG_DATA with the two physical volumes
sudo vgcreate VG_DATA /dev/sdb1 /dev/sdc1
- Create one logical volume name DATA
sudo lvcreate -l 100%FREE --name DATA VG_DATA
- Create the filesystem on your new logical volume DATA
sudo mkfs.ext4 /dev/VG_DATA/DATA
- Mount the volume
sudo mkdir /media/DATA
sudo mount /dev/VG_DATA/DATA /media/DATA
# or /etc/fstab
/dev/VG_DATA/DATA /media/DATA ext4 rw 0 0
- Check your system status again
# list Block Devices
sudo lsblk
# Display information about Physical Volumes
sudo pvs
# Display information about Volume Groups
sudo vgs
# Display information about Logical Volumes
sudo lvs
# Display information about file system disk space usage
df -h
Ref:
- https://serverfault.com/a/692738
- https://www.howtoforge.com/linux_lvm