Skip to content

Instantly share code, notes, and snippets.

@hivivo
Last active January 1, 2020 06:20
Show Gist options
  • Save hivivo/36438efb0b332dcd1ef33054c139bfe8 to your computer and use it in GitHub Desktop.
Save hivivo/36438efb0b332dcd1ef33054c139bfe8 to your computer and use it in GitHub Desktop.
linux devices and sync
# to detach a busy device immediately
umount -l /PATH/OF/BUSY-DEVICE
umount -f /PATH/OF/BUSY-NFS(NETWORK-FILE-SYSTEM)
# locate/identify the busy the process
lsof | grep '/dev/sda1'
pkill target_process
umount /dev/sda1
# kill any processes accessing file
fuser -kim /address
unmount /address
# sync two folders
# -a Do the sync preserving all filesystem attributes
# -v run verbosely
# -u skip files that are newer on the receiver
# --delete delete the files in target folder that do not exist in the source, /home/user/A: source folder, /home/user/B: target folder
rsync -avu --delete "/home/user/A" "/home/user/B"
# format partition
sudo mkfs.ext4 /dev/sdaX
# check attached devices
lsblk
lsblk --fs
# remove all metadata from mp4 file
ffmpeg -i test.mp4 -map_metadata -1 -c:v copy -c:a copy out.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment