Sunday, January 31, 2016

Automount a disk at machine start up.

Automount a disk at machine start up.

Recently bought an additional hard disk of 1 TB for my home pc running Centos. After you plugin your disk to the machine, the system does not automounts it. It detects the new hardware and assigns it a dev id(deviceId)
To automount the disk at computer start up follow the following steps:

  1. Find the UUID of the newly added disk. You can find it by running the following command
  2. [root@paragWS ~]# blkid
    /dev/sdb1: UUID="dffb1c9c-29e9-4a00-add1-ad08d90c9469" TYPE="xfs"
    /dev/sdb2: UUID="SJhaki-0CLf-GDmR-j8LW-e1pL-hcwP-sQVnZJ" TYPE="LVM2_member"
    /dev/mapper/centos-root: UUID="cb3625db-6ee0-431f-884e-022037e66e48" TYPE="xfs"
    /dev/sda: UUID="c3d18886-59cc-4aba-aff8-c1f5403af506" TYPE="ext3"

  1. Create an entry in fstab which looks like this:
  2. [root@paragWS ~]# cat /etc/fstab

    #
    # /etc/fstab
    # Created by anaconda on Tue Dec  6 00:17:24 2015
    #
    # 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/centos-root /                       xfs     defaults        0 0
                …

                # /dev/sda SATA 1TB
                   UUID=c3d18886-59cc-4aba-aff8-c1f5403af506 /mnt/VideoData                   ext3     defaults        0 0

Default settings used above are equivalent to rw, suid, dev, exec, auto, nouser, async. Read more here


No comments:

Interview Question Preperation : Find longest subarray whose sum is equal to K

Software Engineering Practice interview question Given a array of N elements. Find the length of Longest Subarray whose sum is equal to give...