Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Mount :- used to mount a file system All files accessible in a Unix system are arranged in one big tree,

the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree The standard form of the mount command, is mount -t type device dir This tells the kernel to attach the file system found on device (which is of type type) at the directory dir. The previous contents (if any) and owner and mode of dir become invisible, and as long as this file system remains mounted, the pathname dir refers to the root of the file system on device Three forms of invocation do not actually mount anything:mount -h : prints a help message mount -v : prints aversion string mount -l : lists all mounted file systems mount --bind olddir newdir : it is possible to remount part of the file hierarchy somewhere else This call attaches only (part of) a single filesystem, not possible submounts. mount --rbind olddir newdir: The entire file hierarchy including submounts is attached a second place. mount --move olddir newdir: atomically move a subtree to another place. mount /dev/cdrom: any user can mount the file system found on his CDROM using this command /etc/fstab : this file may contain lines describing what devices are usually mounted umount : used to un mount the mounted file /etc/mtab : The programs mount and umount maintain a list of currently mounted file systems in the file /etc/mtab mount -a : mounts all the file systems listed in fstab mount -n : Mount without writing in /etc/mtab. This is necessary for example when /etc is on a readonly file system. mount -r : Mount the file system read-only. A synonym is -o ro mount -w : Mount the file system read/write. This is the default. A synonym is -o rw mount -L label : Mount the partition that has the specified label mount -U uuid : Mount the partition that has the specified uuid. mount -t vfstype : The argument following the -t is used to indicate the file system type

PREPARED BY RAVI KUMAR LANKE

Page 1

( a ) Mount Windows share using mount command


This is simple way to share data between windows and linux system. You would like to access MS-Windows share called //windowsserver/sharename by mounting to /mnt/win directory under Linux system. Type the following command (replace username, windows server name, share name and password with actual values):
# mkdir -p /mnt/win # mount -t smbfs -o username=winntuser,password=mypassword //windowsserver/sharename /mnt/win # cd /mnt/win # ls -l

For the share //windowsserver/sharename to be automatically mounted at every system start (after reboot), insert an option in the file /etc/fstab:
# vi /etc/fstab

Append following line (written in a single line)


//windowserver/share /mnt/win smbfs auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15, credentials=/etc/sambapasswords 0 0

Next create the password file /etc/sambapasswords:


# vi /etc/sambapasswords

Now add following content:


username = winntuser password = mypassword

Save and close the file. Make sure only root can access your file:
# chown 0.0 /etc/sambapasswords # chmod 600 /etc/sambapasswords

PREPARED BY RAVI KUMAR LANKE

Page 2

You might also like