This is an old revision of the document!
Create a File system
Device recognition
First, when we add a new disk, we should be able to see it with the following command:
[root@lparaca ~]# fdisk -l Disk /dev/sdh: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x00000000 **********************************************
Partition Creation
After that we have to create a partition for that device using the same command, a device can have 4 primary partitions and many more extended partitions. Here we will create a primary partition for device /dev/sdh
[root@lparaca ~]# fdisk /dev/sdh Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x36089e2c. 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): n <- Create partition Command action e extended p primary partition (1-4) p <- Primary Partition number (1-4): Value out of range. Partition number (1-4): 1 <- Partition ID in case you have others First cylinder (1-2610, default 1): Using default value 1 <- First Cylinder Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): Using default value 2610 <- Last Cylinder Command (m for help): w <- Write the changes into the header
We can see now that the partition has been created
[root@lparaca ~]# ls /dev/sdh* /dev/sdh **/dev/sdh1**
Volume Group Creation
After we have physical partition, we can create a volume group (e.g. group of physical volumes)
root@lparaca ~]# vgcreate orahome /dev/sdh1 Physical volume "/dev/sdh1" successfully created Volume group "orahome" successfully created [root@lparaca ~]#
Logical Volume and File system creation
After we have the physical Volume we can start slicing it into pieces called Logical Volumes as follows:
Logical Volume
Size VG Name [root@lparaca ~]# lvcreate -L 19G orahome Logical volume "lvol0" created. [root@lparaca ~]#
We can also display the stats of the newly created logical volume with:
root@lparaca ~]# lvdisplay /dev/orahome/lvol0 --- Logical volume --- LV Path /dev/orahome/lvol0 LV Name lvol0 VG Name orahome LV UUID hHtiIK-1kSn-RgIF-Aw8Y-M3WT-88HD-ZIXD6q LV Write Access read/write LV Creation host, time lparaca, 2018-01-11 11:18:08 +0100 LV Status available # open 0 LV Size 19.00 GiB Current LE 4864 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2
File System
Once the logical volume is created, we can create a file system on it. There are two main types of file systems:
- Journal File systems: ext3, ex4
- Non-Journal: ext2
We will create a journal file system to prevent from corruption in case of a power outage.
[root@lparaca ~]# mkfs.ext4 /dev/orahome/lvol0 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 1245184 inodes, 4980736 blocks 249036 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 152 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, 2654208, 4096000 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 33 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@lparaca ~]#
Once the file system is created we can mount, but before that we have to edit the /etc/fstab, indificated what and where we mount it:
# # /etc/fstab # Created by anaconda on Thu Jan 11 10:24:16 2018 # # 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_lparaca-lv_root / ext4 defaults 1 1 UUID=d05f17dc-5506-446d-802b-10b0e8528411 /boot ext4 defaults 1 2 /dev/mapper/vg_lparaca-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/orahome/lvol0 /u01/app/oracle/product/11.2.0/ ext4 defaults 0 0 **
Mount of the file system
Once the file system is created and the /etc/fstab file edited as mentioned above, we can MOUNT the file system as follows:
[root@lparaca ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Thu Jan 11 10:24:16 2018 # # 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_lparaca-lv_root / ext4 defaults 1 1 UUID=d05f17dc-5506-446d-802b-10b0e8528411 /boot ext4 defaults 1 2 /dev/mapper/vg_lparaca-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/orahome/lvol0 /u01/app/oracle/product/11.2.0/ ext4 defaults 0 0 [root@lparaca ~]# mkdir -p /u01/app/oracle/product/11.2.0/ [root@lparaca ~]# mount /u01/app/oracle/product/11.2.0/ [root@lparaca ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_lparaca-lv_root 18G 1.7G 15G 10% / tmpfs 939M 0 939M 0% /dev/shm /dev/sda1 477M 28M 425M 7% /boot /dev/mapper/orahome-lvol0 19G 44M 18G 1% **/u01/app/oracle/product/11.2.0** [root@lparaca ~]#