3/2/2019 - 8:54 PM

Linux Ubuntu Snippets

Umount the filesystem and then run hdparm -S 1 /dev/sdb to set it to spin down after five seconds (replace /dev/sdb with the actual device for the hard disk). This will minimize the power used and heat generated by the hard disk.

Fire up a terminal.

  1. [IMPORTANT] sudo cp /etc/fstab /etc/fstab.old - Create a backup of the fstab file just in case something unwanted happens.
  2. sudo blkid - Note the UUID of the partition you want to automount.
  3. sudo nano /etc/fstab - Copy the following line to the end of the file, save it and reboot afterwards to check if it worked.
  4. mkdir /my/path/tomount # to quote : "you must create the mount point before you mount the partition." see


A common setup is:

UUID=<uuid> <pathtomount> <filesystem> defaults 0 0

Use lsblk -o NAME,FSTYPE,UUID to find out the UUIDs and filesystems of the partition you want to mount. For example:

├─sda5 swap   498d24e5-7755-422f-be45-1b78d50b44e8
└─sda1 ext4   d4873b63-0956-42a7-9dcf-bd64e495a9ff


UUID=<uuid> <pathtomount> ntfs uid=<userid>,gid=<groupid>,umask=0022,sync,auto,rw 0 0

Examples for the <> variables:

  • <uuid>=3087106951D2FA7E
  • <pathtomount>=/home/data/ # create this before rebooting
  • <userid>=1000
  • <groupid>=1000

Use id -u <username> to get the userid and id -g <username> to get the groupid.

(Note that specifying the sync option can slow down write performance as it disables the cache. async is the default.)

UUID=EEA2B69CA2B668AB /WIN_C ntfs-3g defaults,nls=utf8,umask=000,dmask=027,fmask=137,uid=1000,gid=1000,windows_names 0 0

sudo blkid.


How can I give full permission to folder and subfolder

Press Ctrl+Alt+T to go to a terminal and type:

sudo mkdir /var/szDirectoryName

sudo chmod a+rwx /var/szDirectoryName

Mount all drives on fstab

mount -a

sudo nano /etc/samba/smb.conf

    comment = Accounts data directory
    path = /data/accounts
    valid users = vivek raj joe
    public = no
    writable = yes
    force user = userXXXXXX
sudo smbpasswd -a user
sudo chown user:sambashare /media/device/
sudo chmod 2770 /media/device/
sudo systemctl restart smbd.service nmbd.service

Setting up the drives using MergerFS

apt-get install mergerfs fuse

# drive entries below abbreviated for formatting purposes
/dev/disk/by-id/ata-WDC_WD60...449UPL-part1    /mnt/parity1   ext4 defaults 0 0
/dev/disk/by-id/ata-WDC_WD60...V3-part1        /mnt/disk1     ext4 defaults 0 0
/dev/disk/by-id/ata-Hit...11YNG5SD3A-part1     /mnt/disk2     xfs  defaults 0 0
/dev/disk/by-id/ata-WDC_WD...32015-part1       /mnt/disk3     xfs  defaults 0 0
/dev/disk/by-id/ata-TOSH...3544DGKS-part1      /mnt/disk4     xfs  defaults 0 0
/dev/disk/by-id/ata-WDC_WD...074096-part1      /mnt/disk5     xfs  defaults 0 0

/mnt/disk*     /mnt/storage     fuse.mergerfs direct_io,defaults,allow_other,minfreespace=50G,fsname=mergerfs 0 0