Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Search this Thread
Old 10-06-2011, 07:41 AM   #1
LQ Newbie
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
how to create new mount point in linux

how to create new mount point in linux
Can any one explain me with examples Please..........

Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-06-2011, 08:22 AM   #2
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 189Reputation: 189
Creating a mount point is as simple as:
sudo mkdir /media/iso
as an example, lets say you have just inserted a USB HDD.

use fdisk to show a list of the partitions the system can find, in this example, i want to mount the 2nd FAT32 partition, which is attached to /dev/sdc4
fukawi1 ~ # sudo fdisk -l
Disk /dev/sdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000adf6b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63      128519       64228+   b  W95 FAT32
/dev/sdc2   *   126947328   127195135      123904   83  Linux
/dev/sdc3       127197182   156301311    14552065    5  Extended
/dev/sdc4          128520   126945629    63408555    b  W95 FAT32
/dev/sdc5       127197184   154982399    13892608   8e  Linux LVM
/dev/sdc6       154984448   156301311      658432   8e  Linux LVM
you would then create a mount point using:
fukawi1 ~ # sudo mkdir /media/usb_hdd
and then mount the filesystem to the mount point, using:
fukawi1 ~ # sudo mount /dev/sdc /media/usb_hdd
if you run mount without any options, it will give you a list of the mounted filesystems, do this to make sure the filesystem mounted properly. You should now be able to cd to the mountpoint, and view the contents of the filesytem. gives you a rundown on linux filesystems.
2 members found this post helpful.
Old 10-06-2011, 09:04 AM   #3
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
fukawi1 beat me to it, but here's another example.

A mount point is merely an empty directory somewhere. So all you need to do is 'mkdir'. (Note: I'm su'd to root, so I don't need to prefix my commands with 'sudo'.)

[root@athlon ~]# ls /home
lost+found  thomaslovell  tommy

[root@athlon ~]# mkdir /home/mystuff

[root@athlon ~]# ls -l /home
total 28
drwx------.  2 root  users 16384 Mar 14  2011 lost+found
drwxr-xr-x.  2 root  root   4096 Oct  6 09:19 mystuff
drwx------.  7   501 users  4096 Apr 30 17:27 thomaslovell
drwx------. 31 tommy users  4096 Jul 17 08:24 tommy
[root@athlon ~]#
But I'm sure you really are asking the question because you want to mount a filesystem on it.

You may just want to mount an existing filesystem there, but I'll do a new one from scratch. The filesystem will be an LVM Logical Volume.

(An LVM logical volume is a block device that is treated exactly the same as a physical partition like /dev/sdXY, which is also a block device.)

[root@athlon ~]# vgs
  VG     #PV #LV #SN Attr   VSize VFree  
  athlon   1   4   0 wz--n- 1.36t 987.16g

[root@athlon ~]# lvs
  LV   VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  bkup athlon -wi-ao 300.00g                                      
  home athlon -wi-ao   4.00g                                      
  root athlon -wi-ao 100.00g                                      
  swap athlon -wi-ao   6.00g                                      

[root@athlon ~]# lvcreate -L10G -n mystufflv athlon
  Logical volume "mystufflv" created

[root@athlon ~]# mkfs.ext4 /dev/mapper/athlon-mystufflv 
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 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

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@athlon ~]#
Now I have a newly formatted filesystem on block device /dev/mapper/athlon-mystufflv.

(To emphasize the point, that's the equivilent of a partition, like /dev/sdXY. They are both block devices.)

I can now manually mount it on my new mount point /home/mystuff, and umount it if I wish.

(Note: a device cannot be umounted if it is use. If you attempt a umount and it says device is busy, then some process has a file open on that filesystem. So make sure you have not cd'd into that filesystem when you try to umount it... That's a common error. You can use the lsof or fuser commands to see who - 'lsof +D /home/mystuff' would tell you that).

[root@athlon ~]# df -h | grep home
                      4.0G  503M  3.3G  14% /home

[root@athlon ~]# mount /dev/mapper/athlon-mystufflv /home/mystuff/

[root@athlon ~]# df -h | grep home
                      4.0G  503M  3.3G  14% /home
                      9.9G  151M  9.2G   2% /home/mystuff

[root@athlon ~]# umount /home/mystuff/

[root@athlon ~]# df -h | grep home
                      4.0G  503M  3.3G  14% /home
Or, if I wanted it mounted at boot time, I could add this entry,
/dev/mapper/athlon-mystufflv /home/mystuff ext4 defaults 1 3
to /etc/fstab.
# /etc/fstab
# Created by anaconda on Sun Jul 17 01:51:58 2011
# 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/athlon-root /                       ext4    defaults        1 1
/dev/mapper/athlon-bkup /bkup                   ext4    defaults        1 2
UUID=5e875990-69d1-4c87-9a1c-48c8751d1861 /boot                   ext4    defaults        1 2
/dev/mapper/athlon-home /home                   ext4    defaults        1 2
/dev/mapper/athlon-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/mapper/athlon-mystufflv /home/mystuff      ext4    defaults        1 3
To mount it immediately after editing /etc/fstab, just issue 'mount -a'.

[root@athlon ~]# mount -a
Then you can check if it is mounted with the 'mount' command with no flags.
[root@athlon ~]# mount 
/proc on /proc type proc (rw,relatime)
/sys on /sys type sysfs (rw,relatime,seclabel)
udev on /dev type devtmpfs (rw,nosuid,relatime,seclabel,size=1985740k,nr_inodes=496435,mode=755)
devpts on /dev/pts type devpts (rw,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime,seclabel)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,seclabel,mode=755)
/dev/mapper/athlon-root on / type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
selinuxfs on /selinux type selinuxfs (rw,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/ns type cgroup (rw,nosuid,nodev,noexec,relatime,ns)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
systemd-1 on /dev/mqueue type autofs (rw,relatime,fd=30,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
systemd-1 on /dev/hugepages type autofs (rw,relatime,fd=31,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
systemd-1 on /sys/kernel/security type autofs (rw,relatime,fd=32,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
systemd-1 on /sys/kernel/debug type autofs (rw,relatime,fd=33,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,rootcontext=system_u:object_r:mnt_t:s0,seclabel,mode=755)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
/dev/md1 on /boot type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
/dev/mapper/athlon-home on /home type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
/dev/mapper/athlon-bkup on /bkup type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
/dev/mapper/athlon-root on /tmp type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
/dev/mapper/athlon-root on /var/tmp type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
/dev/mapper/athlon-home on /home type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
/dev/mapper/athlon-mystufflv on /home/mystuff type ext4 (rw,relatime,seclabel,barrier=1,data=ordered)
[root@athlon ~]#
(A lot of "stuff' mounted, but you can see it at the end of the list...)

When you reboot, it'll automatically be mounted for you.

If you are not yet familiar with the man pages they should explain all of the flags available on a command. (They vary in quality sometimes.) Do 'man mount', to see its man page. (Use 'q' to quit out of it.)

Happy motoring.

Last edited by tommylovell; 10-06-2011 at 09:07 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create mount point for unused space. lowsy Linux - Newbie 3 10-29-2009 11:16 PM
Create one mount point / partition from 2 drives sir-lancealot Linux - Server 1 08-11-2009 07:29 PM
puppy+grub saves ram installed mount point as HD install mount point agualust Linux - Newbie 0 04-10-2009 11:23 AM
How to create a persistent mount point for Linux to a windows share in FC6 geetarman Fedora 2 03-16-2007 03:54 AM

All times are GMT -5. The time now is 06:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration