Good Day!
Currently I tried to learn how to make a LVM, using the Ubuntu Desktop but since I don't have much resources yet to achieve this thing. My mind keeps on telling me *later later later*. But as a person i am, my lazy behavior keeps on striking me, not to do something but today i starting to gather everything i need and hell yeah! now i am in the stage where my server is getting an update to their site. I want to share it with you guys since some sites,they are lacking of information's that is important which in your part a quite hassle because your thinking that when you go to the search engine and search into something those engine might directed you to the site which is near in what you are searching for, right? but instead when you click the link you find it not interesting or else helpless then you find yourself still keep on searching to the other sites to be able to get the closes topic that you've been looking for.
Before you start:
You really need this thing:
1.The shown picture is kinda like a virtual computer good for exploring something like an Operating System.If you don't want your PC got broken or afraid of what if ? you can use this one.
Fig 1: The Virtual Box
2. Ubuntu Desktop / Ubuntu Server
Fig 2: Login Interface of Ubuntu Desktop
Fig 3: Ubuntu interface after logging in
So let's begin!!
How to make LVM and Mount partitions
1. You have to create for a new hard disk.
Settings -> Storage ->Click Sata -> Add Hard disk -> Create Name -> Set the Size i Recommend 8 GB for this test -> Click ok -> Then Click the Start
2. Once you Click the Start button, you just wait until the Fig 2 image appear.
3. You need to find the terminal to start altering the system using some of their built in commands.
Fig 4: Terminal Interface
4. Using the Secondary hard disk that we created in the first step.
type -> sudo fdisk /dev/sdb
And it will show the menu's involve in the fdisk command
Once in the fdisk menu:
1. press n to create a new disk partition,
2. press p to create a primary disk partition,
3. press 1 to define it as the first disk partition,
4. press ENTER twice. This converts the whole secondary disk into a single disk partition,
5. press t to select the partition type,
6. press L to list all the supported partition types,
7. press 8e to select Linux LVM partition type,
8. press p to display the secondary hard disk partition setup. it shows you as /dev/sdb1.
9. press w to write the partition table
10. exit fdisk upon completion.
1. press n to create a new disk partition,
2. press p to create a primary disk partition,
3. press 1 to define it as the first disk partition,
4. press ENTER twice. This converts the whole secondary disk into a single disk partition,
5. press t to select the partition type,
6. press L to list all the supported partition types,
7. press 8e to select Linux LVM partition type,
8. press p to display the secondary hard disk partition setup. it shows you as /dev/sdb1.
9. press w to write the partition table
10. exit fdisk upon completion.
1.1 Assign disk partitions to physical volumes
sudo pvcreate /dev/sdb1
1.2 Create Volume Group VG for the /data and /backup volumes
sudo vgcreate myvg_data /dev/sdb1
pvdisplay
vgdisplay
pvdisplay and vgdisplay gives you information about LVM.
1.3 Create Logical Volumes ( LV )
sudo lvcreate -L 500G --name data myvg_data
1.4 Format file system
sudo mke2fs -t ext4 -L /data /dev/myvg_data/data
sudo mke2fs -t ext4 -L /data /dev/myvg_data/data
1.5 Mount file system
Make sure you see the partition mounted and its correct size.
sudo mkdir /data
sudo mount /dev/myvg_data/data /data
df -hT
Make sure you see the partition mounted and its correct size.
1.7. Add it to the system startup
Check disks UUID by installing blkid and takes not of the UUID from /dev/sdb1 – /dev/myvg_data/data
sudo apt-get install id-utils
sudo blkid
Check disks UUID by installing blkid and takes not of the UUID from /dev/sdb1 – /dev/myvg_data/data
sudo apt-get install id-utils
sudo blkid
1.8 Add the following entry in /etc/fstab to have the partition mounted
Add at the end of the file the following lines:
UUID=<enter the uuid number found with blkid> /data ext4 errors=remount-ro 0 1
1.9 Make sure you can write something in to the new partition
2 Reboot the server and make sure that the /data partition is mounted.
sudo vi /etc/fstab
Add at the end of the file the following lines:
UUID=<enter the uuid number found with blkid> /data ext4 errors=remount-ro 0 1
sudo mount -v
sudo umount --force /data
sudo mount -a
sudo mount -v
1.9 Make sure you can write something in to the new partition
touch /data/file1.asc
ls -la /data
2 Reboot the server and make sure that the /data partition is mounted.
Credits to Leonardo Borda:D.
Status: DONE!
No comments:
Post a Comment