Filesystem Hacks
Free reserved space on Ext4 partitions
By default the system reserved blocks for system use only when creating an ext4 partition. On external or secondary disks this is not really neccessary because this is only needed to ensure the system has space to work which only makes sense on the root disk.
To release the reserved blocks for normal users you can use tune2fs
:
tune2fs -r 0 /dev/sdx1
tune2fs -m 0 /dev/sdx1
With the value 0
these commands to the same. The option -r
specifies specified the number, -m
the percentage of reserved blocks. Replace /dev/sdx1
with your partition!
You can also disable journaling to free up more space:
tune2fs -O ^has_journal /dev/sdx1
Again replacing /dev/sdx1
with your partition.
Mount NTFS despite hibernation flag
When a Windows system is shut down in default configuration it usually does a soft shut down to boot up faster. This can be deactivated. If not, all active NTFS partitions used by that Windows instance have the hibernation flag that which results in linux to mount those partitions as read-only. There are two ways to work around that in linux.
-
Simply removing the flag when mounting:
mount -t ntfs-3g -o remove_hiberfile /dev/sdx1 /media/XXX
Make sure to change
/dev/sdx1
and/media/XXX
to your device and mount point. -
Scan and repair the partition:
ntfsfix /dev/sdx1
Make sure to change
/dev/sdx1
to your device.
Blacklist Seagate Usb Hdd From Uas
In case you want to use samrtctl
from starttools and the Seagate USB harddrive enclosure reports no S.M.A.R.T. support, it's propable the UAS kernel driver just doesn't support S.M.A.R.T. over USB. You can use a kernel quirk to disable the device from using UAS.
Get the USB's Vendor and Device ID of your USB HDD with lsusb
:
> lsusb
Bus 002 Device 003: ID 0bc2:331a Seagate RSS LLC Desktop HDD 5TB (ST5000DM000)
...
Create a file /etc/modprobe.d/ignore_uas.conf
and add teh following line replacing 0bc2:331a
with you're devices Vendor and Device ID.
option usb-storage quirks=0bc2:331a:u
Then re-create your inital ramdisk:
update-initramfs -u
And reboot your system.
Connect remote folder via SSH
sshfs user@server:/remote/path /local/path -p 22 -o IdentityFile=/path/to/private.key
The server must be known to connect without interaction.
-p 22
can be omitted or changed to the SSH port of the remote server.
-o IdentityFile...
can be omitted to use a configured SSH key or else a password prompt.
mdadm - Software RAID
Adding or removing drives
mdadm --manage /dev/md0 --add /dev/sdx
mdadm --manage /dev/md0 --remove /dev/sdx
mdadm --manage /dev/md0 --re-add /dev/sdx