In this post we will see how to create a Mount Point in Linux. For this post I'll be using Oracle Linux 6.4 on Virtual Box. This tutorial can be used for any UNIX, but before doing to actually on Live Machine, first use it in Test Machine and if everything is fine do it on Live Machine.
If you are using Linux on VMWare, the step to add storage will be somewhat different but rest of it will be same.
Follow below steps in order to create a mount point on Linux –
If you are using Linux on VMWare, the step to add storage will be somewhat different but rest of it will be same.
Follow below steps in order to create a mount point on Linux –
- Add new SATA disk(s) in Virtual Machine.
Select the Machine where the Linux is installed (In this case dbrhel)
Machine Setting -> Storage -> Controller:SATA -> Add Disk
Provide the required details. - Start the machine and login as root (or any sudoers who has root access)
Check for the new SATA disk that we’ve added in Machine, by using fdisk -l command.
In this case the added SATA/other controller is of 20G, having name /dev/sdc.
[root@dbrhel64 ~]# fdisk - l Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 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: 0x000659a0 Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 3917 30944256 8e Linux LVM Disk /dev/sdc: 16.1 GB, 16106127360 bytes 255 heads, 63 sectors/track, 1958 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 Disk /dev/mapper/vg_dbrhel64-lv_root: 29.6 GB, 29569843200 bytes 255 heads, 63 sectors/track, 3594 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 Disk /dev/mapper/vg_dbrhel64-lv_swap: 2113 MB, 2113929216 bytes 255 heads, 63 sectors/track, 257 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
- Now create a new partition using fdisk /dev/sdc command.
[root@dbrhel ~]# fdisk /dev/sdc Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x7ababe44. 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 Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1958, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-1958, default 1958): Using default value 1958 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
- Use partprobe command. This command will make the device visible to the kernel. Just to verify use fdisk -l again to verify that partition is created or not.
- Now create file system on that partition, use mkfs.ext4 /dev/sdc1 to create the actual file system at block level. You will see that when you run the command.
[root@dbrhel ~]# mkfs.ext4 /dev/sdc1 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 983040 inodes, 3931900 blocks 196595 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4026531840 120 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 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
- Now create a directory which you want to mount on the newly created partition.
[root@dbrhel ~]# mkdir -p /data/users/
- Now add a new line in /etc/fstab, for the newly created partition.
[root@dbrhel users]# tail -2 /etc/fstab proc /proc proc defaults 0 0 /dev/sdb1 /oracle_11204 ext4 defaults 1 1 [root@dbrhel users]# cat >> /etc/fstab /dev/sdc1 /data/users ext4 defaults 1 1 ^C [root@dbrhel users]# tail -2 /etc/fstab /dev/sdb1 /oracle_11204 ext4 defaults 1 1 /dev/sdc1 /data/users ext4 defaults 1 1
- Finally use mount -a command to mount all partition which are present in /etc/fstab file.
[root@dbrhel users]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_dbrhel-lv_root 28G 7.4G 19G 29% / tmpfs 499M 80K 499M 1% /dev/shm /dev/sda1 485M 33M 427M 8% /boot /dev/sdb1 25G 6.2G 18G 27% /oracle_11204 [root@dbrhel users]# mount -a [root@dbrhel users]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_dbrhel-lv_root 28G 7.4G 19G 29% / tmpfs 499M 80K 499M 1% /dev/shm /dev/sda1 485M 33M 427M 8% /boot /dev/sdb1 25G 6.2G 18G 27% /oracle_11204 /dev/sdc1 15G 166M 14G 2% /data/users [root@dbrhel users]#
No comments :
Post a Comment