Skip to content

Instantly share code, notes, and snippets.

@mazgi

mazgi/00.README.md

Last active May 22, 2020
Embed
What would you like to do?
btrfs, raid10, nfs
blantons ~ # lsblk 
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 447.1G  0 disk 
sdb           8:16   0 447.1G  0 disk 
sdc           8:32   0 465.8G  0 disk 
sdd           8:48   1 465.8G  0 disk 
nvme0n1     259:0    0 238.5G  0 disk 
|-nvme0n1p1 259:1    0   512M  0 part /boot
|-nvme0n1p2 259:2    0     2G  0 part [SWAP]
`-nvme0n1p3 259:3    0   236G  0 part /var/log
blantons ~ # mkfs.btrfs -m raid10 -d raid10 /dev/sd{a,b,c,d}
btrfs-progs v5.4.1 
See http://btrfs.wiki.kernel.org for more information.

/dev/sda appears to contain an existing filesystem (btrfs).
ERROR: use the -f option to force overwrite of /dev/sda
blantons ~ # mkfs.btrfs -m raid10 -d raid10 /dev/sd{a,b,c,d} -f
btrfs-progs v5.4.1 
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM /dev/sda (447.13GiB) ...
Performing full device TRIM /dev/sdb (447.13GiB) ...
Performing full device TRIM /dev/sdc (465.76GiB) ...
Performing full device TRIM /dev/sdd (465.76GiB) ...
Label:              (null)
UUID:               589da0a7-20e9-4960-a700-2f11696ac946
Node size:          16384
Sector size:        4096
Filesystem size:    1.78TiB
Block group profiles:
  Data:             RAID10            2.00GiB
  Metadata:         RAID10          512.00MiB
  System:           RAID10           16.00MiB
SSD detected:       yes
Incompat features:  extref, skinny-metadata
Checksum:           crc32c
Number of devices:  4
Devices:
   ID        SIZE  PATH
    1   447.13GiB  /dev/sda
    2   447.13GiB  /dev/sdb
    3   465.76GiB  /dev/sdc
    4   465.76GiB  /dev/sdd
blantons ~ # btrfs filesystem show
Label: none  uuid: 8d779341-9727-4cfa-b47f-7c0744069be5
	Total devices 1 FS bytes used 5.52GiB
	devid    1 size 235.97GiB used 7.02GiB path /dev/nvme0n1p3

Label: none  uuid: 589da0a7-20e9-4960-a700-2f11696ac946
	Total devices 4 FS bytes used 128.00KiB
	devid    1 size 447.13GiB used 1.26GiB path /dev/sda
	devid    2 size 447.13GiB used 1.26GiB path /dev/sdb
	devid    3 size 465.76GiB used 1.26GiB path /dev/sdc
	devid    4 size 465.76GiB used 1.26GiB path /dev/sdd
blantons ~ # mkdir -p /mnt/workspace
blantons ~ # mount UUID=589da0a7-20e9-4960-a700-2f11696ac946 /mnt/btrfs 
blantons ~ # btrfs subvolume create /mnt/btrfs/workspace
Create subvolume '/mnt/btrfs/workspace'
blantons ~ # umount /mnt/btrfs/
blantons ~ # vi /etc/fstab 
blantons ~ # tail -1 /etc/fstab 
UUID=589da0a7-20e9-4960-a700-2f11696ac946	/mnt/workspace	btrfs	defaults,subvol=workspace	0 1
blantons ~ # mount -a
blantons ~ # df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             10M     0   10M   0% /dev
/dev/nvme0n1p3  236G  5.6G  230G   3% /
tmpfs           3.2G  680K  3.2G   1% /run
cgroup_root      10M     0   10M   0% /sys/fs/cgroup
shm              16G     0   16G   0% /dev/shm
/dev/nvme0n1p1  511M   29M  483M   6% /boot
/dev/nvme0n1p3  236G  5.6G  230G   3% /home
/dev/nvme0n1p3  236G  5.6G  230G   3% /var/db/repos
/dev/nvme0n1p3  236G  5.6G  230G   3% /var/log
/dev/sda        913G   17M  894G   1% /mnt/btrfs
/dev/sda        913G   17M  894G   1% /mnt/workspace
blantons ~ # emerge -uavq net-fs/nfs-utils
[ebuild  N    ] sys-apps/tcp-wrappers-7.6.28  USE="ipv6 (split-usr) -netgroups -static-libs" ABI_X86="(64) -32 (-x32)" 
[ebuild  N    ] dev-db/sqlite-3.31.1  USE="readline -debug -doc -icu -secure-delete -static-libs -tcl -test -tools" ABI_X86="(64) -32 (-x32)" 
[ebuild  N    ] sys-apps/keyutils-1.6.1  USE="(split-usr) -static -static-libs -test" ABI_X86="(64) -32 (-x32)" 
[ebuild  N    ] net-libs/rpcsvc-proto-1.4.1 
[ebuild  N    ] net-nds/rpcbind-1.2.5  USE="tcpd -debug -remotecalls (-selinux) -systemd -warmstarts" 
[ebuild  N    ] net-fs/nfs-utils-2.4.1-r4  USE="ipv6 libmount nfsidmap nfsv4 tcpd uuid -caps -junction -kerberos -ldap -nfsdcld -nfsv41 (-selinux)" 

Would you like to merge these packages? [Yes/No] 
>>> Verifying ebuild manifests
>>> Emerging (1 of 6) sys-apps/tcp-wrappers-7.6.28::gentoo
>>> Installing (1 of 6) sys-apps/tcp-wrappers-7.6.28::gentoo
>>> Emerging (2 of 6) dev-db/sqlite-3.31.1::gentoo
>>> Installing (2 of 6) dev-db/sqlite-3.31.1::gentoo
>>> Emerging (3 of 6) sys-apps/keyutils-1.6.1::gentoo
>>> Installing (3 of 6) sys-apps/keyutils-1.6.1::gentoo
>>> Emerging (4 of 6) net-libs/rpcsvc-proto-1.4.1::gentoo
>>> Installing (4 of 6) net-libs/rpcsvc-proto-1.4.1::gentoo
>>> Emerging (5 of 6) net-nds/rpcbind-1.2.5::gentoo
>>> Installing (5 of 6) net-nds/rpcbind-1.2.5::gentoo
>>> Emerging (6 of 6) net-fs/nfs-utils-2.4.1-r4::gentoo
>>> Installing (6 of 6) net-fs/nfs-utils-2.4.1-r4::gentoo
>>> Recording net-fs/nfs-utils in "world" favorites file...
>>> Jobs: 6 of 6 complete                           Load avg: 3.19, 2.27, 1.31

 * Messages for package net-fs/nfs-utils-2.4.1-r4:

 * If you use OpenRC, the nfsmount service has been replaced with nfsclient.
 * If you were using nfsmount, please add nfsclient and netmount to the
 * same runlevel as nfsmount.

!!! existing preserved libs found
blantons ~ # umount /mnt/workspace
blantons ~ # vi /etc/fstab 
blantons ~ # tail -1 /etc/fstab 
UUID=589da0a7-20e9-4960-a700-2f11696ac946	/export/workspace	btrfs	defaults,subvol=workspace	0 1
blantons ~ # mkdir -p /export/workspace
blantons ~ # mount -a
blantons ~ # lsblk 
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 447.1G  0 disk /export/workspace
sdb           8:16   0 447.1G  0 disk 
sdc           8:32   0 465.8G  0 disk 
sdd           8:48   1 465.8G  0 disk 
nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot
├─nvme0n1p2 259:2    0     2G  0 part [SWAP]
└─nvme0n1p3 259:3    0   236G  0 part /var/log
blantons ~ # chmod a+rwx /export/workspace/
blantons ~ # vi /etc/exports.d/workspace.exports
blantons ~ # cat /etc/exports.d/workspace.exports
/export/workspace	172.16.17.0/20(insecure,rw,sync,no_subtree_check)
blantons ~ # vi /etc/conf.d/nfs
blantons ~ # grep -vE '^\s*(#|$)' /etc/conf.d/nfs
NFS_NEEDED_SERVICES="rpc.idmapd"
OPTS_RPC_NFSD="8"
OPTS_RPC_MOUNTD=""
OPTS_RPC_STATD=""
OPTS_RPC_IDMAPD=""
OPTS_RPC_GSSD=""
OPTS_RPC_SVCGSSD=""
OPTS_RPC_RQUOTAD=""
EXPORTFS_TIMEOUT=30
blantons ~ # rc-update add nfs default
 * service nfs added to runlevel default
blantons ~ # /etc/init.d/nfs restart
blantons ~ # exportfs
/export/workspace
		172.16.17.0/20

Mount the NFS volume on Windows

2020-05-17

2020-05-17 (6)

2020-05-17 (3)

2020-05-17 (4)

2020-05-17 (7)

2020-05-17 (8)

2020-05-17 (9)

Mount the NFS volume on macOS

Screen Shot 2020-05-17 at 15 35 14

Screen Shot 2020-05-17 at 15 35 37

on the NFS server

blantons ~ # ls -l /export/workspace/
total 0
drwxr-xr-x 1 4294967294 4294967294 0 May 17 06:32 'New folder'
drwxr-xr-x 1        501 dialout    0 May 17 06:34 'untitled folder'
blantons ~ # vi /etc/exports.d/workspace.exports 
blantons ~ # cat /etc/exports.d/workspace.exports
/export/workspace	172.16.17.0/20(insecure,rw,sync,no_subtree_check,all_squash)
blantons ~ # /etc/init.d/nfs restart
blantons ~ # rm -rf /export/workspace/*

(Create files from macOS and Windows)

blantons ~ # ls -lR /export/workspace/
/export/workspace/:
total 0
drwxr-xr-x 1 nobody nobody 30 May 17 07:03 'New folder'
drwxr-xr-x 1 nobody nobody 42 May 17 07:02 'untitled folder'

'/export/workspace/New folder':
total 0
-rw-r--r-- 1 nobody nobody 0 May 17 07:03 new-file-by-mac

'/export/workspace/untitled folder':
total 0
-rwxr-xr-x 1 nobody nobody 0 May 17 07:02 'New Text Document.txt'
@mazgi

This comment has been minimized.

Copy link
Owner Author

@mazgi mazgi commented May 17, 2020

ls -lh ~/Downloads/IMG_2926.MOV
-rw-r--r--@ 1 mazgi  staff   699M May 12 05:22 /Users/mazgi/Downloads/IMG_2926.MOV

Copy: macOS <-> NFS

/Volumes/workspace time cp ~/Downloads/IMG_2926.MOV .
cp ~/Downloads/IMG_2926.MOV .  0.00s user 3.26s system 15% cpu 20.471 total
/Volumes/workspace time cp IMG_2926.MOV /tmp/        
cp IMG_2926.MOV /tmp/  0.00s user 1.79s system 17% cpu 10.302 total

bonding

time cp /Volumes/workspace/IMG_2926.MOV /tmp/
cp /Volumes/workspace/IMG_2926.MOV /tmp/  0.00s user 1.09s system 11% cpu 9.806 total
time cp /tmp/IMG_2926.MOV /Volumes/workspace/ 
cp /tmp/IMG_2926.MOV /Volumes/workspace/  0.00s user 5.28s system 45% cpu 11.579 total
@mazgi

This comment has been minimized.

Copy link
Owner Author

@mazgi mazgi commented May 17, 2020

Copy: Windows <-> NFS

PS C:\Users\mazgi> Measure-Command { copy W:\IMG_2926.MOV C:\tmp }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 8
Milliseconds      : 724
Ticks             : 87246419
TotalDays         : 0.00010097965162037
TotalHours        : 0.00242351163888889
TotalMinutes      : 0.145410698333333
TotalSeconds      : 8.7246419
TotalMilliseconds : 8724.6419



PS C:\Users\mazgi> Measure-Command { copy C:\tmp\IMG_2926.MOV W:\ }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 13
Milliseconds      : 957
Ticks             : 139575975
TotalDays         : 0.000161546267361111
TotalHours        : 0.00387711041666667
TotalMinutes      : 0.232626625
TotalSeconds      : 13.9575975
TotalMilliseconds : 13957.5975

bonding

PS C:\Users\mazgi> Measure-Command { copy W:\IMG_2926.MOV C:\tmp }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 7
Milliseconds      : 189
Ticks             : 71890919
TotalDays         : 8.32070821759259E-05
TotalHours        : 0.00199696997222222
TotalMinutes      : 0.119818198333333
TotalSeconds      : 7.1890919
TotalMilliseconds : 7189.0919



PS C:\Users\mazgi> Measure-Command { copy C:\tmp\IMG_2926.MOV W:\ }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 15
Milliseconds      : 240
Ticks             : 152404619
TotalDays         : 0.000176394234953704
TotalHours        : 0.00423346163888889
TotalMinutes      : 0.254007698333333
TotalSeconds      : 15.2404619
TotalMilliseconds : 15240.4619
@mazgi

This comment has been minimized.

Copy link
Owner Author

@mazgi mazgi commented May 17, 2020

(other) Copy: Windows <-> Drobo (SATA HDDs, CIFS)

PS C:\Users\mazgi> Measure-Command { copy C:\tmp\IMG_2926.MOV Z:\ }


Days              : 0
Hours             : 0
Minutes           : 1
Seconds           : 4
Milliseconds      : 156
Ticks             : 641567114
TotalDays         : 0.000742554530092593
TotalHours        : 0.0178213087222222
TotalMinutes      : 1.06927852333333
TotalSeconds      : 64.1567114
TotalMilliseconds : 64156.7114



PS C:\Users\mazgi> Measure-Command { copy Z:\IMG_2926.MOV C:\tmp }


Days              : 0
Hours             : 0
Minutes           : 1
Seconds           : 2
Milliseconds      : 814
Ticks             : 628149679
TotalDays         : 0.000727025091435185
TotalHours        : 0.0174486021944444
TotalMinutes      : 1.04691613166667
TotalSeconds      : 62.8149679
TotalMilliseconds : 62814.9679
@mazgi

This comment has been minimized.

Copy link
Owner Author

@mazgi mazgi commented May 22, 2020

blantons% dd if=/dev/zero of=/export/workspace/img bs=1M count=1024 conv=fdatasync,notrunc status=progress 
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.89193 s, 568 MB/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment