Find and remove duplicated hard link files
To remove duplicated hard link files using following command. The hard link files could be created by rmlint
deduplication.
find . -type f -links +1 -printf '%i %n %p\n' -exec rm '{}' \;
To remove duplicated hard link files using following command. The hard link files could be created by rmlint
deduplication.
find . -type f -links +1 -printf '%i %n %p\n' -exec rm '{}' \;
Note: Haven't got chance to test this.
sfdisk -d /dev/sdX > part_table
sfdisk /dev/sdY < part_table
This will keeping the same disk & partition IDs, mainly for backup and restore partition purpose.
grep -v ^label-id part_table | sed -e 's/, *uuid=[0-9A-F-]*//' | sfdisk /dev/sdY
How to copy the partition layout of a whole disk using standard tools
In Synology, move share folder to another volume is quite easy, can be done via UI interface. In TrueNAS, I could not find such task can be selected.
The workable solution is utilize the zfs command to duplicate in SSH environment, then export old pool and import new one.
First make a snapshot poolX/dataset@initial
, then use following command duplicate zfs dataset snapshot to new zpool.
zfs send poolX/dataset@initial | zfs recv -F poolY/dataset
Then make another snapshot poolX/dataset@incremental
, then use following command update zfs dataset snapshot to new zpool.
zfs send -i initial poolX/dataset@incremental | zfs recv poolY/dataset
To make the new dataset usable, rollback snapshot needs to be performed for new dataset.
Change shared point to use new pool.
This is only required if client used server filesystem structure, such as NFS.
Migrate to smaller disk
*Note: pv (Pipe Viewer) command is not installed in TrueNAS by default.