markdown Linux Ubuntu Snippets

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 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 <https://help.ubuntu.com/community/Fstab>

## Examples

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:

```
$ lsblk -o NAME,FSTYPE,UUID
NAME   FSTYPE UUID
sda
├─sda2
├─sda5 swap   498d24e5-7755-422f-be45-1b78d50b44e8
└─sda1 ext4   d4873b63-0956-42a7-9dcf-bd64e495a9ff
```

### NTFS

```
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`.

 `sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL`
# 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`
```bash
sudo nano /etc/samba/smb.conf

[accounts]
    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
```

以上是关于markdown Linux Ubuntu Snippets的主要内容,如果未能解决你的问题,请参考以下文章

markdown Ubuntu启用交换文件#linux

Ubuntu/Linux 笔记应用 为知笔记(支持markdown)

ubuntu or linux 安装markdown editor Typora

markdown 预备Linux ubuntu服务器或Digital ocean droplet

markdown 添加ppa dan install certbot di ubuntu linux

markdown 无头Dropbox客户端unuk keperluan传输数据di Ubuntu Linux无头环境