Mount it! Part 1: How to manually mount your Local Hard Drive:

how-to-upgrade-your-playstation-3-hard-drive_1

NOTE:  This is an old article and remains here for posterity.  The updated article can be found at:

http://wp.me/ptjWO-dB  (short link)

http://thelinuxcauldron.com/2013/06/20/core-concepts-understanding-fstab-and-seriously-wtf-is-fstab/

 

.

.

.

.

You connect your new external drive, USB drive, or even want to connect to your local server’s hard drive share.  In this post of Linux Cauldron, we will show you the in’s and out’s of mounting Hard Drives.  Mounting server shares, will be covered in a later tutorial!

First thing you will want to do is get familiar with the Terminal command “fdisk -l”  Output would appear as so

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x73d273d2Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3916    31455238+   7  HPFS/NTFS
/dev/sda2            3917        5744    14683410    7  HPFS/NTFS
/dev/sda3            5745        9479    30001387+   5  Extended
/dev/sda4            9480        9729     2008125   82  Linux swap / Solaris
/dev/sda5            5745        9479    30001356   83  Linux

You want to get familiar with the above command and what each area means:

  • Device boot is the “location” of that particular hard drive.  Typically each partition will be appended with a number, and generally prefixed with “sda.”
  • Don’t be too concerned about the start and end sections, it is not necessary for this tutorial.  Same goes for blocks and ID
  • Take note of the “System.”  This is the file system type of your hard drive, this will help determine which drive is which, other than the “label” you may have given your drive.

Next we will tack simple use of the “mount” command in Linux for quick mounting of drives

  • First, take note of what “/dev” location your unmounted hard drive is.  Many times a drive will not mount, because it was improperly removed in Linux OR Windows.  This includes not “unmounting” the drive via the GUI in liux, the Termainl in linux, or using the “Safely Remove” function in windows.
  • The syntax for a typical mount is “sudo mount /dev/hard_drive / /mnt” , where hard_drive is you your drive location such as “sda1”
  • While you want to always boot back into windows if you can and “Safely Remove” the drive first. Other wise type “sudo mount /dev/hard_drive/ /mnt -o force” This will force the drive to mount, and reset that particlar drive’s Log File.
  • If you wish to “unmount” the Hard Drive, syntax is as follows, with sudo optional “sudo umount /dev/hard_drive” If the drive will not umount type “lsof /dev/hard_drive” to try and find out what process has its death grip on the drive.  If you REALLY wish to unmount it, type the following, “sudo umount -f /dev/hard_drive

Next we will tackle Creating an “fstab” entry in “/etc/fstab”

  • to edit fstab, you will need root privileges.  Obtain this by either dropping to a root shell with “sudo su -” or by doing “sudo nano /etc/fstab”
  • You will an entry or several entries here.  The basic syntax is <file system>, <mount point>, <type>, <options>, <dump>, and <pass>.
  • <file system>: the location of the drive, for example, “/dev/sda3″ NOTE: what I typically do here is use the “blkid” command and note the information for that particular drive.  Instead of “/dev/hard_drive” you can use that drive’s UUID (explained below).
  • <mount point>: Where you want the drive mounted, for example, “/mnt/my_drive” (assuming you made a folder called “my_drive” in the /mnt folder)
  • <type>: If you drive is ntfs , this will be “ntfs-3g“, if it is ext3, this would be “ext3” or if it was FAT32, it would be “fat32
  • <options>: put defaults for most occasions
  • <dump>: put 0
  • <pass>: put 0

Explanation of a drive’s UUID (universal unique Identifier)

  • type the command “blkid” into Terminal.  This will show you the “/dev/location”, the UUID for that drive, nad its TYPE
  • type the command”vol_id -u /dev/hard_drive” to get the UUID for that hard drive.  hard_drive is your devices location in “/dev”
  • you can use this UUID of this information in your fstab entry for <file system, that is normally the “/dev/hard_drive”
  • This is a good idea to do this as it is a Truly Unique Identification for your hard drive.  Device names are not always persistent.  They are named according to the order of loading the kernel modules usually at start up time, and names may be different if for instance, you boot up with a flash drive plugged in.  GRUB itself relies on UUIDs for /boot/grub/menu.lst

Now I will show you two examples of an fstab entry:

  • # / was on /dev/sda5 during installation
  • UUID=e26f0af2-ab9d-4307-9372-33b7fbfb2ca2 /               ext4    relatime,errors=remount-ro 0       1
  • #my added ntfs drive
  • /dev/sda2                 /mnt/my_ntfs1         ntfs-3g          defaults   0   0

You will have to reboot to apply the mounts.


So, that’s it for today, if you have any questions, be sure to hit up the “Contact Us” link or leave a comment on this blog entry.  I will def. take suggestions for this guide, and I welcome any criticism.

Thanks for reading,

_Nano

About professorkaos64

www.libregeek.org

Posted on 20090321, in Basics, How-To, Terminal and tagged , , , , , , . Bookmark the permalink. 10 Comments.

  1. That’s a nice and informative post. Mine is about flash drives, and I hope, is worth a view. Check it out:
    http://opensourcethefuture.blog.co.in/2009/08/28/manually-mounting-a-flash-drive-in-linux/

  2. Hi, Neat post. There’s an issue along with your website in internet explorer, may check this? IE nonetheless is the market leader and a good portion of people will miss your fantastic writing because of this problem.

    • professorkaos64

      I would suggest making sure you have the latest Internet Explorer (version 9), or use an alternative browser. I really can’t control a lot of what word press does. Outside the enterprise, I do not know really anyone that doesn’t use Firefox/Google Chrome/ or Safari. Internet Explorer has been a “dead horse” for quite some time. The only reason IE is a “leader” is it is the default and preinstalled web browser on Windows machines, which by proxy is in decline. Thank you very much for visiting.

  3. I have been browsing on-line greater than 3 hours lately, yet I
    never discovered any interesting article like yours.

    It’s lovely worth enough for me. In my view, if all website owners and bloggers made just right content as you did, the internet might be a lot more useful than ever before.

    • professorkaos64

      Hopefully you used the updated article haha. I personally use my blog as a journal of my Linux experiences rather than selling myself out to what someone else wants. I really love it when I get a comment like this every once INA while , as it makes me feel happy that there are a few people out there who like my articles. Time is always against me, and I don’t write nearly as often as I want, but I try to add my personal experience to the matter. Thanks for reading and take care.

  4. Normally I don’t read article on blogs, however I would like to say that this write-up very pressured me to check out and do so! Your writing style has been surprised me. Thanks, quite great article.

  5. Every weekend i used to pay a visit this web page, for the reason that
    i wish for enjoyment, for the reason that this this web site conations actually
    pleasant funny material too.

  1. Pingback: Mount It! Part 2: How to mount a local Server Share « The_Linux_Cauldron

Leave a comment