How to mount my 2nd drive at startup?

Post fully complete "how to" guides and tutorials here. This is a great place to get feedback on stuff you might put in the wiki.

Moderators: khz, MattKingUSA

armchair_rambo
Established Member
Posts: 6
Joined: Thu May 11, 2017 4:00 am

How to mount my 2nd drive at startup?

Postby armchair_rambo » Thu May 11, 2017 4:06 am

I'm pretty sure fstab needs to be edited, can someone please tell me how to mount my 2nd hard drive at startup?

I download using sda but move torrents to sdb when they are done. Need sdb to attach to /media/STORAGE/

I'm not totally a newbie, but not far from one. Mostly used Fedora before now. I'm sorry if this is in some FAQ but I don't know what it is I don't know.

Thanks so much for any assistance you can offer!

finotti
Established Member
Posts: 354
Joined: Thu Sep 01, 2011 9:07 pm

Re: How to mount my 2nd drive at startup?

Postby finotti » Thu May 11, 2017 2:53 pm

Well, it depends... Can you show us your current /etc/fstab?

I prefer to use UUID to identify the disk. You can find it with:

Code: Select all

ls -l /dev/disk/by-uuid/

See what is pointing to sdb. Then, remove (or edit) the previous sdb line and add something like:

Code: Select all

UUID=<UUID you found here>     /media/STORAGE         ext4         auto,users,rw,exec,noatime                   0    2

(Assuming that sdb is formatted as ext4.)

Be careful: if you are using systemd, it seems that errors in fstab makes the system unbootable in regular mode. (I think you have to start on safe-mode to fix it.)

armchair_rambo
Established Member
Posts: 6
Joined: Thu May 11, 2017 4:00 am

Re: How to mount my 2nd drive at startup?

Postby armchair_rambo » Thu May 11, 2017 4:46 pm

Thanks for the response. This is what I have in fstab now::

# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=499efdba-1d68-4009-983d-4bcc21268eaa / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=cbba5c5c-818b-4487-a001-5be3527c7e0f none swap sw 0 0

After mounting sdb manually, here's the output from blkid:

/dev/sda1: UUID="499efdba-1d68-4009-983d-4bcc21268eaa" TYPE="ext4"
/dev/sda5: UUID="cbba5c5c-818b-4487-a001-5be3527c7e0f" TYPE="swap"
/dev/sdb1: UUID="499efdba-1d68-4009-983d-4bcc21268eaa" TYPE="ext4"
/dev/sdb2: LABEL="STORAGE" UUID="42d4b973-b6d6-4537-a512-16ffccec877b" TYPE="ext4"

I'm trying to attach sdb2 to sda5 at /media/STORAGE/

Thanks!
Last edited by armchair_rambo on Thu May 11, 2017 5:12 pm, edited 1 time in total.

finotti
Established Member
Posts: 354
Joined: Thu Sep 01, 2011 9:07 pm

Re: How to mount my 2nd drive at startup?

Postby finotti » Thu May 11, 2017 5:10 pm

armchair_rambo wrote:Thanks for the response. This is what I have in [b]fstab[/b] now::

# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=499efdba-1d68-4009-983d-4bcc21268eaa / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=cbba5c5c-818b-4487-a001-5be3527c7e0f none swap sw 0 0

After mounting sdb manually, here's the output from blkid:

/dev/sda1: UUID="499efdba-1d68-4009-983d-4bcc21268eaa" TYPE="ext4"
/dev/sda5: UUID="cbba5c5c-818b-4487-a001-5be3527c7e0f" TYPE="swap"
/dev/sdb1: UUID="499efdba-1d68-4009-983d-4bcc21268eaa" TYPE="ext4"
/dev/sdb2: LABEL="STORAGE" UUID="42d4b973-b6d6-4537-a512-16ffccec877b" TYPE="ext4"


So, I think (don't hold me responsible if something goes wrong!) your /etc/fstab should look something like this:

Code: Select all

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=499efdba-1d68-4009-983d-4bcc21268eaa /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=cbba5c5c-818b-4487-a001-5be3527c7e0f none            swap    sw              0       0
UUID=42d4b973-b6d6-4537-a512-16ffccec877b     /media/STORAGE         ext4         auto,users,rw,exec,noatime                   0    2


armchair_rambo wrote:I'm trying to attach sdb2 to sda5 at /media/STORAGE/


I don't understand this sentence... (sda5 is swap... what do you mean to attach?) Anyway, the above should automatically mount sdb2 to /media/STORAGE.

armchair_rambo
Established Member
Posts: 6
Joined: Thu May 11, 2017 4:00 am

Re: How to mount my 2nd drive at startup?

Postby armchair_rambo » Thu May 11, 2017 5:14 pm

Ha yes I got it wrong, not gonna be using a swap drive for storage.

I appreciate the advice, I know enough to be dangerous but know
enough to make a backup of fstab first. Thanks for the info,
caveat emptor! I'll give it a try and report back.

armchair_rambo
Established Member
Posts: 6
Joined: Thu May 11, 2017 4:00 am

Re: How to mount my 2nd drive at startup?

Postby armchair_rambo » Thu May 11, 2017 5:35 pm

It worked perfectly, thanks a lot! I used your code without changing anything in it.

Can't tell you how annoying it was to manually mount the drive at every boot!

Cheers, friend.


Return to “HOW TOs, Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest