Link to home
Start Free TrialLog in
Avatar of Pumpernickel
PumpernickelFlag for United States of America

asked on

Linux auto mount second drive

# /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?
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

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

Avatar of Pumpernickel

ASKER

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
can you post
fdisk -l /dev/sdb
You mean

fdisk -l /dev/sdb1

????  or would it be sdb
No
fdisk -l /dev/sdb
  not sdb1
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
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?
Ubuntu 11.04
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?
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:~$
> fuse: failed to access mountpoint /ntfs1: No such file or directory
Please read this carefully.
https://www.experts-exchange.com/questions/27242910/Linux-auto-mount-second-drive.html?cid=1572&anchorAnswerId=36355065#a36355065
sudo mount -t ntfs /dev/sdb1  /ntfs1


command worked.  I'm going to reboot to see if it auto mounts
It didn't auto mount.
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
/ntfs1/ folder contains my ntfs partition files.  Thanks!!!!!!!!!!!!!!!!!!!!!!!
I mean /ntfs2/ folder has my ntfs partition files.