by HostMonster Reviews

How to mount a Linux partition on boot

Published: Saturday, 27 September 2014

Scenario: a partition is visible and accessible as "root" but invisible / inaccessible as a "user"; and you dont want to always have be prompted to login as root to access the partition. Perhaps some software/s need to write to the partition once they are launched - for example, if you change the download destination(save) DIR of Qbittorrent to the external partition, and you need to access your server via http.

Note" I want /dev/sdb8 to be visible & mounted for user-accounts. This example is on a debian server.

1) Find out the UUID of your installed hard-drives.

command: as root, type: "blkid"

 root@debian7:/home/tokunbo# blkid
/dev/sdb7: UUID="81da432f-e86d-4252-bf1d-2e755d11ce9a" TYPE="swap"
/dev/sda1: UUID="580463D30463B2A4" TYPE="ntfs"
/dev/sda2: UUID="2AD4A224D4A1F26D" TYPE="ntfs"
/dev/sdb1: UUID="8b65e40d-8a36-4683-927f-42051115c0be" SEC_TYPE="ext2" TYPE="ext 3" LABEL="60GBDeb6"
/dev/sdb5: UUID="e85f516d-ee0a-4aba-8c05-969a0e3bf3fa" TYPE="swap"
/dev/sdb6: UUID="872544f1-b74e-4172-a35e-6e0d1ac82215" TYPE="ext4" LABEL="60GBDe b7"
/dev/sdb8: LABEL="FREE30G" UUID="63A888FF514722A5" TYPE="ntfs"

2) df -h to see disk space and mount points:

command: df -h

 root@debian7:/home# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 56G 20G 33G 37% /
udev 10M 0 10M 0% /dev
tmpfs 151M 652K 151M 1% /run
/dev/disk/by-uuid/872544f1-b74e-4172-a35e-6e0d1ac82215 56G 20G 33G 37% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.5G 144K 1.5G 1% /run/shm
/dev/sdb8 28G 17G 12G 58% /media/FREE30G

3) edit file: /etc/fstab and add the new ntfs partition information:

# /etc/fstab: static file system information.
# Use 'blkid' 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>
# / was on /dev/sdb6 during installation
UUID=872544f1-b74e-4172-a35e-6e0d1ac82215 / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb7 during installation
UUID=81da432f-e86d-4252-bf1d-2e755d11ce9a none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/sdb8 /media/FREE30G ntfs-3g permissions,locale=en_US.utf8 0 2

save and reboot your server.

Now, 'Free30G' is available to all users.


0 #1 2017-04-29 15:27
I like this web blog so much, saved to fav.

Add comment

Security code