LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



Reply
 
Search this Thread
Old 10-06-2011, 08:41 AM   #1
raffimalik
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..........

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

Rep: Reputation: 189Reputation: 189
Creating a mount point is as simple as:
Code:
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
Code:
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:
Code:
fukawi1 ~ # sudo mkdir /media/usb_hdd
and then mount the filesystem to the mount point, using:
Code:
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.

http://www.linuxhotbox.com/adminguide/lnag_drives.html gives you a rundown on linux filesystems.
 
2 members found this post helpful.
Old 10-06-2011, 10:04 AM   #3
tommylovell
Member
 
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'.)

Eg.
Code:
[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.)

Code:
[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).

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

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

[root@athlon ~]# df -h | grep home
/dev/mapper/athlon-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
/dev/mapper/athlon-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.
Code:
#
# /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'.

Code:
[root@athlon ~]# mount -a
Then you can check if it is mounted with the 'mount' command with no flags.
Code:
[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 10:07 AM.
 
Old 02-01-2015, 11:02 PM   #4
69Rixter
Member
 
Registered: Jan 2014
Location: central Ohio
Distribution: LM17 cinnamon
Posts: 161

Rep: Reputation: Disabled
Question Creating a Mounting Point

Evening:

I've tried to mount a Dana-Elec 4Gb pendrive using the following:

rick@rick-HP-2000-Notebook-PC ~ $ sudo mkdir media/usb_hdd
[sudo] password for rick:
mkdir: cannot create directory ‘media/usb_hdd’: No such file or directory
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb /media/usb_hdd
mount: mount point /media/usb_hdd does not exist
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb media/iso
mount: mount point media/iso does not exist
rick@rick-HP-2000-Notebook-PC ~ $ sudo mkdir /media/iso
mkdir: cannot create directory ‘/media/iso’: File exists
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb /media/iso
mount: you must specify the filesystem type
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb /media/NTFS
mount: mount point /media/NTFS does not exist
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb/NTFS
mount: can't find /dev/sdb/NTFS in /etc/fstab or /etc/mtab
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb1
mount: can't find /dev/sdb1 in /etc/fstab or /etc/mtab

These are all directly from this thread and none have worked. Any suggestions? [HP2000-210~ LinuxMint 17.1]
RICK
 
Old 02-01-2015, 11:30 PM   #5
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,456

Rep: Reputation: 598Reputation: 598Reputation: 598Reputation: 598Reputation: 598Reputation: 598
Are you missing the partition #?
 
Old 02-01-2015, 11:35 PM   #6
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1}
Posts: 2,419

Rep: Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000
Quote:
Originally Posted by 69Rixter View Post
Evening:

I've tried to mount a Dana-Elec 4Gb pendrive using the following:

rick@rick-HP-2000-Notebook-PC ~ $ sudo mkdir media/usb_hdd
[sudo] password for rick:
mkdir: cannot create directory ‘media/usb_hdd’: No such file or directory
You are trying to make /home/rick/media/usb_hdd, but /home/rick/media does not exist...
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb /media/usb_hdd
mount: mount point /media/usb_hdd does not exist
You did not create /media/usb_hdd - media/usb_hdd != /media/usb_hdd...
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb media/iso
mount: mount point media/iso does not exist
...see first error - /home/rick/media/iso does not exist...
rick@rick-HP-2000-Notebook-PC ~ $ sudo mkdir /media/iso
mkdir: cannot create directory ‘/media/iso’: File exists
So /media/iso already exists, use it...
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb /media/iso
mount: you must specify the filesystem type
...so do what it says, specify the filesystem in the mount command...
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb /media/NTFS
mount: mount point /media/NTFS does not exist
Why did you do this? Why not specify the filesystem as expected?...
(I suspect that you somehow think that /media/NTFS is a filesystem specifier?)

rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb/NTFS
mount: can't find /dev/sdb/NTFS in /etc/fstab or /etc/mtab
...ditto...
rick@rick-HP-2000-Notebook-PC ~ $ sudo mount /dev/sdb1
mount: can't find /dev/sdb1 in /etc/fstab or /etc/mtab
...just what it says...

These are all directly from this thread and none have worked. Any suggestions? [HP2000-210~ LinuxMint 17.1]
RICK
Even if they were, and they are not, why would you expect them to work on your system which may be different?
See...

Code:
man mkdir
man mount
Most of the problems in your case result from not knowing the difference between absolute and relative paths. Absolute paths begin with a forward slash, '/' and require the complete path specification from the root directory. Relative paths do not begin with the forward slash and begin in whatever your current directory is. The tilde, '~' in your prompt indicates that you were in your home directory, /home/rick/ when you issued some of those commands, so relative paths would begin there instead of the root directory.

Assuming /dev/sdb to be your drive, and assuming it to be NTFS, this should get you going...

Code:
sudo mkdir /media/usb_hdd - note the leading '/'
mount -t ntfs /dev/sdb /media/usb_hdd - note type specification and proper path

But more likely, as pointed out by EDDY1, you will need to include a partition number, .../sdb1 

mount -t ntfs /dev/sdb1 /media/usb_hdd
You should also read up on basic Unix/Linux filesystem paths, shell commands, etc - the Rute Exposition is a good place to start, and as always, read the man pages for commands that you are having trouble with.

Good luck!

Last edited by astrogeek; 02-01-2015 at 11:59 PM.
 
Old 02-02-2015, 04:32 PM   #7
69Rixter
Member
 
Registered: Jan 2014
Location: central Ohio
Distribution: LM17 cinnamon
Posts: 161

Rep: Reputation: Disabled
Pendrive suddenly won't mount

RESPONDING TO : Astrogeek

Thanx for your information. Tried to use the command you suggested and it didn't work? Command line report: mount: mount point media/usb_hdd does not exist.

Thanx for Trying:
Rick
 
Old 02-02-2015, 04:38 PM   #8
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1}
Posts: 2,419

Rep: Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000Reputation: 1000
Quote:
Originally Posted by 69Rixter View Post
RESPONDING TO : Astrogeek

Thanx for your information. Tried to use the command you suggested and it didn't work? Command line report: mount: mount point media/usb_hdd does not exist.

Thanx for Trying:
Rick
The mount point in your message is NOT the one I suggested (no leading /). Please read that again.

Lets not chase ghosts, can you please post exactly the command you used and exactly the response.

Last edited by astrogeek; 02-03-2015 at 12:45 AM. Reason: clarity
 
Old 02-03-2015, 04:40 PM   #9
69Rixter
Member
 
Registered: Jan 2014
Location: central Ohio
Distribution: LM17 cinnamon
Posts: 161

Rep: Reputation: Disabled
Pendrive suddenly won't mount

REPLY TO: astrogeek/ Interested parties

OK, read "Mount Point Definition" www.linfo.org/mount_point.html. Plugged in flashdrive and it mounted on it's own @ /media/rick/3825-EC4C. I have no explanation for this.(?) I'm just wondering if it will mount the next time I use it, and if not, I'll use the sequence/command: mount -t ntfs /dev/sdb1 /media/rick/3825-EC4C then I'll need to find a "mountpoint" that is "persistent". Now, I'd be interested in any explanations and a mountpoint (just in case) that would be persistent. Another thought I was going to try was using the mountpoint from one of my other pendrives that automatically mounts. Hmmm...this has just been one perplexing, aggravating experience. But, hopefully, I've learned from it!
THANX:
Rick

P.S. How do I go about posting thread as solved...even though I don't know what the solution was/is?

Last edited by 69Rixter; 02-03-2015 at 04:45 PM. Reason: Additional info
 
Old 02-03-2015, 04:50 PM   #10
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 3,420

Rep: Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236
Quote:
Originally Posted by 69Rixter View Post
Hmmm...this has just been one perplexing, aggravating experience.
Because you are apparently paying very little attention to the commands posted. Instead, you're just typing out bastardized versions of them and scratching your head when they fail.

As has been pointed out before:
media/iso
and
/media/iso

Are NOT the same directory! The leading slash is incredibly important. The leading slash is the Linux version of C:\.

If your terminal is in /home/user, and you type media/iso, it tells the computer you're referring to the (probably non-existant) directory /home/user/media/iso. You MUST put the leading slash in front if you want to refer to the absolute path /media/iso, rather than the relative path /whereever/the/hell/I/currently/am/media/iso.

You are also ignoring any and all error messages that the terminal is spitting out, and are just continuing on with your commands like everything is fine. When the terminal tells you something, it's not doing it for giggles, it's doing it because it's trying to tell you something important. Read and pay attention to the output from the commands you type.




Anyway - those directories that are created for auto-mounts are not permanent, they are cleaned up as soon as you unplug the drive. If you want to make a permanent directory, then just make one, but PAY ATTENTION TO WHAT YOU'RE TYPING.

It's NOT "sudo mkdir media/usb_hdd", it's "sudo mkdir /media/usb_hdd".

http://www.linuxnix.com/2012/07/absl...linuxunix.html

Last edited by suicidaleggroll; 02-03-2015 at 04:52 PM.
 
1 members found this post helpful.
Old 02-03-2015, 05:53 PM   #11
yancek
Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 5,322

Rep: Reputation: 854Reputation: 854Reputation: 854Reputation: 854Reputation: 854Reputation: 854Reputation: 854
Quote:
Plugged in flashdrive and it mounted on it's own @ /media/rick/3825-EC4C
Ubuntu and most of its derivatives do that, when you plugin a flash drive it is accessible under /media/user (in your case /media/rick) so that will happen whenever you plug it in. The "3825-EC4C" is the UUID for that drive/partition and won't change unless you change the flash drive, such as deleting a partition.

The explanation is you probably didn't look. If you did, I don't have an explanation either.

I would suggest you run the df -T command to find the filesystem type on the flash drive as it is probably vfat not ntfs.

Last edited by yancek; 02-03-2015 at 05:56 PM.
 
  


Reply


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-30-2009 12:16 AM
Create one mount point / partition from 2 drives sir-lancealot Linux - Server 1 08-11-2009 08:29 PM
puppy+grub saves ram installed mount point as HD install mount point agualust Linux - Newbie 0 04-10-2009 12:23 PM
How to create a persistent mount point for Linux to a windows share in FC6 geetarman Fedora 2 03-16-2007 04:54 AM


All times are GMT -5. The time now is 06:45 AM.

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