Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


Disks

TODO: split this cheat sheets in multiple dedicated ones (one per command).

Reference(s)

Table of contents


udisksctl

# emerge -a sys-fs/udisks
# pacman -S udisks2
# apt install udisks2
# yum install udisks2
# dnf install udisks2

Turn off a disk after unmounting it:

$ sudo udisksctl unmount -b /dev/disk/by-label/disklabal && sudo udisksctl power-off -b /dev/disk/by-label/disklabal


df

  • Check disks space:
    $ df -kh
    

TODO


du

TODO


lsblk

  • Check disks partitions:
    $ lsblk -f # (no need for blkid)
    

ncdu

  • Browse disks space:
    $ ncdu
    

mount/umount

  • Mount an NTFS disk with 755 permissions for directories and 644 for files:

    $ sudo mount -t ntfs-3g /dev/... /media/... -o uid=1001,gid=1001,dmask=022,fmask=133
    

  • Mount a CIFS disk (e.g. samba server?) (⚠️ Prerequisite package for Ubuntu: cifs-utils):

    $ sudo mount -t cifs "//server.address/path/to/plop" /mnt/mountpoint -o user=username,password=passphrase
    

  • Unmount a disk:

    $ sudo umount /dev/disk/by-label/
    or
    $ sudo umount /media/disk/mount-location/
    

  • Eject a disk:

    $ sudo umount /dev/disk/by-label/
    or
    $ sudo umount /media/disk/mount-location/
    

  • Very safe way to unplug HDD by putting it in sleep mode first:

    $ sudo sync; sudo hdparm -Y /dev/disk/by-label/ # now one can unplug hdd
    


If this cheat sheet has been useful to you, then please consider leaving a star here.