Linux auto mount second drive

cmb991
cmb991 used Ask the Experts™
on
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=c211da5c-e709-4975-af51-4b961287f0dc /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
#UUID=ee6d75c3-ba7c-4518-af06-b1016d6f02e4 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0


I'm trying to auto mount /etc/sdb .  What would I have to add for it to do this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2011

Commented:
1. format second hard disk
fdisk /dev/sdb

2. added into /etc/fstab
/dev/sdb1   /HDD2   ext4  errors=remount-ro  0    1
Hi

You can also mount it by uuid.

ls -al /dev/disk/by-uuid/ | grep sdb

You will see the uuid points to the specific partition like

0841fc25-19b1-4d6e-aeb5-3c1013648450 -> ../../sdb1

Then you can add it to /etc/fstab

0841fc25-19b1-4d6e-aeb5-3c1013648450  /YOURMOUNTPOINT  ext4    errors=remount-ro  0    1

Author

Commented:
wesly chan: I tried this but when I boot up, it gives me an error that the file system on that hdd2 isn't ex4.  This is a windows drive, so can I do:

/dev/sdb1   /HDD2   ntfs  errors=remount-ro  0    1
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Top Expert 2011

Commented:
can you post
fdisk -l /dev/sdb

Author

Commented:
You mean

fdisk -l /dev/sdb1

????  or would it be sdb
Top Expert 2011

Commented:
No
fdisk -l /dev/sdb
  not sdb1

Author

Commented:
sudo fdisk -l /dev/sdb

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf26953d4

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sdb2              13       38914   312466432    7  HPFS/NTFS
Top Expert 2011

Commented:
Does this command work?
mkdir -p /ntfs1 /ntfs2
# mount  /dev/sdb1  /ntfs1

What's your Linux distribution? RedHat/CentOS 5.x, Ubuntu 10.x, Fedora, OpenSuSE?

Author

Commented:
Ubuntu 11.04
Top Expert 2011

Commented:
sudo apt-get install ntfs-config

Then
sudo mount -t ntfs /dev/sdb1  /ntfs1
or
sudo mount -t ntfs-3g /dev/sdb1  /ntfs1

and which one works for you?

Author

Commented:
christopher@cmbubuntu:~$ sudo mount -t ntfs /dev/sdb1 /ntfs1
[sudo] password for christopher:
fuse: failed to access mountpoint /ntfs1: No such file or directory
christopher@cmbubuntu:~$ sudo mount -t ntfs-3g /dev/sdb1 /ntfs1
fuse: failed to access mountpoint /ntfs1: No such file or directory
christopher@cmbubuntu:~$
Top Expert 2011

Commented:
> fuse: failed to access mountpoint /ntfs1: No such file or directory
Please read this carefully.
http://www.experts-exchange.com/OS/Linux/Q_27242910.html?cid=1572#a36355065

Author

Commented:
sudo mount -t ntfs /dev/sdb1  /ntfs1


command worked.  I'm going to reboot to see if it auto mounts

Author

Commented:
It didn't auto mount.
Top Expert 2011
Commented:
Before reboot, please change your /etc/fstab to
-----------------
/dev/sdb1 /ntfs1 ntfs     defaults,locale=en_US.utf8 0 0
/dev/sdb2 /ntfs2 ntfs     defaults,locale=en_US.utf8 0 0

Author

Commented:
/ntfs1/ folder contains my ntfs partition files.  Thanks!!!!!!!!!!!!!!!!!!!!!!!

Author

Commented:
I mean /ntfs2/ folder has my ntfs partition files.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial