Mounting a drive and accessing it

51,864

Let's take it from the beginning. First of all, you mount partitions, not disks. So, mount /dev/sdb won't work, mount /dev/sdb1 will (assuming you want to mount the 1st partition of sdb). To be able to access the drive with cd /name you need to either mount it at /name or make /name a symlink to /mnt/name. To actually mount it at /name do the following:

sudo mkdir /name
sudo chmod 755 /name

Add this line to /etc/fstab

/dev/sdb1 /name ext3 defaults 0 1

Then mount it: mount /name

To mount the partition in /mnt and link it to /name do

sudo mkdir /mnt/name
sudo chmod 755 /mnt/name
sudo ln -s /mnt/name /

Add this line to /etc/fstab

/dev/sdb1 /mnt/name ext3 defaults 0 1

Then mount it: mount /mnt/name

Share:
51,864
Ahmad
Author by

Ahmad

Updated on September 18, 2022

Comments

  • Ahmad
    Ahmad over 1 year

    I have created a partition on /dev/sdb

    I want to be able to go to this drive when I type:

    cd /name
    

    What I did, which did not work.

    • mkdir name in /mnt
    • mounted the /dev/sdb on /mnt/name
    • updated the fstab: /dev/sdb /name ext3 defaults 0 1
    • mount -a (when i do this i get this message: 'the /name is not found')

    What am I doing wrong here. Running latest Debian distro

    • Hauke Laging
      Hauke Laging almost 11 years
      If you have created a partition on sdb then is does not make any sense to try mounting sdb itself. Given your level of understanding: Why don't you use your distro's tools to do that?
  • Ahmad
    Ahmad almost 11 years
    Well, if I create a '/name' in the root directory and try to mount '/dev/sdb' to '/home', I get a message saying that mount point '/name' does not exist