how to create ext4 partition in oracle linux 6

Upload: joao-oliveira-criscuolo

Post on 02-Jun-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 How to Create Ext4 Partition in Oracle Linux 6

    1/3

    How to create ext4 partition in Oracle Linux 6.3 64bit

    POSTED ONOCTOBER 19, 2013 UPDATED ONJULY 31, 2014

    Like we added a new Harddisk in our Linux machine and wanted to format in ext4 partitionso here is the process.

    When we add a disk it will be displayed under /dev directory.

    [oracle@OEL64 ~]$ ls -l /dev/sd*brw-rw-. 1 root disk 8, 0 Oct 18 23:19 /dev/sdabrw-rw-. 1 root disk 8, 1 Oct 18 23:20 /dev/sda1brw-rw-. 1 root disk 8, 2 Oct 18 23:19 /dev/sda2brw-rw-. 1 root disk 8, 16 Oct 18 23:19 /dev/sdb [oracle@OEL64 ~]$

    Login to root user and create a new partition in this new drive:

    [oracle@OEL64 ~]$ surootPassword:[root@OEL64 ~]# fdisk /dev/sdb

    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0x66845514.Changes will remain in memory only, until you decide to write them.

    After that, of course, the previous content wont be recoverable.

    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

    WARNING: DOS-compatible mode is deprecated. Its strongly recommended toswitch off the mode (command c) and change display units tosectors (command u).

    Command (m for help): p

    Disk /dev/sdb: 16.1 GB, 16106127360 bytes255 heads, 63 sectors/track, 1958 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x66845514

    Device Boot Start End Blocks Id System

    Command (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First cylinder (1-1958, default 1):Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-1958, default 1958):Using default value 1958

    Command (m for help): wThe partition table has been altered!

    https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/https://getsomeoracle.wordpress.com/2013/10/19/how-to-create-ext4-partition-in-oracle-linux-6-3-64bit/
  • 8/10/2019 How to Create Ext4 Partition in Oracle Linux 6

    2/3

    Calling ioctl() to re-read partition table.Syncing disks.[root@OEL64 ~]#

    So I created 1 partition /dev/sdb1 above.

    Verify it:

    [root@OEL64 ~]# fdisk /dev/sdb

    WARNING: DOS-compatible mode is deprecated. Its strongly recommended toswitch off the mode (command c) and change display units tosectors (command u).

    Command (m for help): p

    Disk /dev/sdb: 16.1 GB, 16106127360 bytes255 heads, 63 sectors/track, 1958 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk identifier: 0x66845514Device Boot Start End Blocks Id System

    /dev/sdb1 1 1958 15727603+ 83 Linux

    Command (m for help): quit

    [root@OEL64 ~]#

    Format the drive in ext4 using below command:

    [root@OEL64 ~]# mkfs.ext4 /dev/sdb1

    mke2fs 1.41.12 (17-May-2010)Filesystem label=

    OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks983040 inodes, 3931900 blocks196595 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=4026531840120 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:

    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208Writing inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done

    This filesystem will be automatically checked every 33 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.[root@OEL64 ~]#

  • 8/10/2019 How to Create Ext4 Partition in Oracle Linux 6

    3/3

    Create a directory /u02 and mount it to the above new created partition:

    [root@OEL64 ~]# mkdir /u02[root@OEL64 ~]#[root@OEL64 ~]# mount -t ext4 /dev/sdb1 /u02/[root@OEL64 ~]#

    [root@OEL64 ~]# df -khFilesystem Size Used Avail Use% Mounted on/dev/mapper/VOL01-LogVol0126G 19G 5.7G 77% /tmpfs 1001M 276K 1000M 1% /dev/shm

    /dev/sda1 194M 50M 134M 28% /boot/dev/sdb1 15G 166M 14G 2% /u02[root@OEL64 ~]#[root@OEL64 ~]#

    Put the entry in /etc/fstab, so that next time it will be up while rebooting the system:

    [root@OEL64 ~]# cat /etc/fstab

    ## /etc/fstab# Created by anaconda on Sat Sep 14 17:37:19 2013## 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/VOL01-LogVol01 / ext4 defaults 1 1UUID=433b2669-dd25-4429-bad6-4f62ba2901f3 /boot ext4 defaults 1 2

    /dev/mapper/VOL01-LogVol00 swap swap defaults 0 0tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0

    sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0

    /dev/sdb1 /u02 ext4 defaults 1 1[root@OEL64 ~]#