-
Notifications
You must be signed in to change notification settings - Fork 255
Using 2nd Harddrive
📂 Click Here - Sign up for Google's Suite for Business - Unlimited Space
📂 Click Here - NZB's with from NewsHost - PG Members Receive a 58% Discount
Table of Contents
- Intro
- Creating a file partition
- Create the Partition
- edit fstab
- Create the folder for mounting
- use the symlink
- use mount bind
- shell script for crontab
- Troubleshooting
Situation:
Have a 250GB SSD and a second 2TB harddrive? The problem that you'll run into with PlexGuide is that all of your stuff downloading and uploading will target your PRIMARY DRIVE (in this example, the 250GB SSD).
The following instructions will assist you in SETTING up your second harddrive.
To check, type df -h and if you notice your OTHER HD not there, you need to follow the steps below.
/// PICTURE HERE ///
fdisk -l
Pay attention to the name of the new disk
type fdisk name-of-drive (mine was /dev/sdb)
m
- print menu
if there is a valid partition, you can delete it with d
n
- add new partition
p
- to create a primary partition
1
- choose number of partition (pick only 1)
Press enter twice
press w
to write to disk and exit
create a file system
mkfs.ext4 /dev/sdb
-- keep pushing enter until done
Now we can create the folder for the secondary drive, the best options is this one.
mkdir /mnt2/
What is fstab ??
short explain about fstab,
Fstab is your operating system’s file system table. In the old days, it was the primary way that the system mounted files automatically. Nowadays, you can plug in a USB drive of any kind and it’ll just pop up in Nautilus like it does in Windows and Mac OS, but once upon a time, you had to manually mount those disks to a specific folder using the “mount” command. This held true for DVDs, CDs, and even floppies (remember those?).
Back then, your only alternative was the tell the computer that anytime a specific device was plugged in, it should be automatically mounted in a specific place. This is where fstab came in, and it was awesome. Suppose you swapped hard disks on your IDE or SCSI controller. The computer could load the file systems in a different order, potentially messing things up. Fstab is configured to look for specific file systems and mount them automatically in a desired way each and every time, preventing a myriad of disasters from occurring.
type blkid
- look for the name of device you're loooking for, mine was /dev/sdb
copy the uuid number
/dev/sdb: UUID="707cf076-5656-4b07-a062-989df6813fa3" TYPE="ext4"
type: nano /etc/fstab
Enter at the bottom of the file:
UUID="707cf076-5656-4b07-a062-989df6813fa3" /mnt2 ext4 defaults 0 0
(edit the UUID with the UUID of your harddrive you found earlier)
ctrl + x
to save
type: sudo reboot
or mount -a
then
type: mount /mnt2
now we can creat and remove the old folder (link symlink) if you want to bind the folder you need only to create the folder
sudo mkdir /mnt2/move
short explain about Symlink
Well, ln -s creates a symbolic link, whereas mount --bind creates a mount.
A symbolic link is a special type of file. If you do ln -s /var/target /var/link, then /var/link will be a file containing the path "/var/target" in it. The only difference between a symbolic link and an ordinary file is that when a program tries to perform an operation on a symbolic link, the operation is usually performed on the target instead of the file. So now if you do ls /var/link, the ls program will try to get a directory listing for /var/link, but will actually get a directory listing for /var/target instead.
If you want to use the symlink variante , please use the follow commands.
first we create the folder for the symlink
sudo mkdir /mnt2/move
and now we create the symlink
sudo ln -s /mnt2/move /mnt/move
and finish
if you want to test the symlink typ the follow command
df -h /mnt/move
it will show you the empty space ;-)
the other option are mount --bind
short explain
A bind mount is an alternate view of a directory tree. Classically, mounting creates a view of a storage device as a directory tree. A bind mount instead takes an existing directory tree and replicates it under a different point. The directories and files in the bind mount are the same as the original
use the follow commands for this
mount --bind /mnt2/move /mnt/move
now the bind is done,
if you want to test is
df -h /mnt/move
the next step is, we give the user the permissions back to creat files and deleted files.
chown -cR user-name:user-name /mnt/move
// edit user-name to your username //
and the bind and the permission are finish ,but if you reboot your server you must repeat the step.
normaly Linux don't need a reboot , but sometimes we need a reboot. but linux are not stupid we can use the follow script,
Please :!: do all this as root member , not as User.
Mount options can only change Root.
Step 1.)
apt-get install nano && cd && nano mount.sh
Step 2.) Only change this part = user-name:user-name to your user name
#!/bin/bash
##mount options
mount --bind /mnt2/move /mnt/move
chown -cR user-name:user-name /mnt/move
exit 0
and save CTRG + X and Y
Step 3 .)
crontab -e
Step 4.) go to the end of the list ( press page-down )
@reboot bash /root/mount.sh >/dev/null 2>&1
if you follow this steps correctly , now the secondary HDD is hardmountet over "/mnt/move"
Q1.) the secondary HDD is not mounten over /mnt/move
A1.) The biggest Problem is , you have to forgotten to change your Username, please check:
/// cat /root/mount.sh
see the line -->>
"" chown -cR user-name:user-name /mnt/move ""
Q2.) Who can i check it ?
A2.) you can check it so ->> ""df -h /mnt/move ""
Q3.) After reboot the script mounte the secondary HDD not correctly :!:
A3.) Please check this --
"crontab -e"
If you add the crotab as User you donˋt canˋt mount as User. The mount options are only for root.
Please checck this double.
Q4.) ..""..
If you need help go to this Thread ;
If you this like this ; Follow as 👍
Home - https://plexguide.com