Skip to content

Partitions

Troubleshoot

- Format of a drive: ``

Extend an ext4 partition

  • Unmount: umount /dev/vdb1
  • Check FS: e2fsck /dev/vdb1 or fsck /dev/vdb1
  • Resize: resize2fs /dev/vdb1
  • Check FS again: e2fsck /dev/vdb1 or fsck /dev/vdb1
  • Mount: mount /dev/vdb1

Grow a live filesystem

Not recommended, but should work.

Expand the partition with sudo cfdisk /dev/sda (I think you can also use growpart /dev/sda 1) Expand ext4 filesystem with resize2fs /dev/sda3.

Now you should check for errors with sudo e2fsck /dev/sda3, but the filesystem can not be mounted for it to check it. A reboot will check for errors.


Mounts

Bind mount

mount --bind /some/where /else/where
mount --bind /some/where /else/where -o ro
mount /some/where /else/where -o bind,ro

Also mount submountpoints. Mountpoints inside /some/where are not accessible from /else/where by default.

mount --rbind /some/where /else/where

HDD spindown timeout

Install hdparm

sudo pacman -S hdparm

First it has to support APM (Advanced Power Management)

sudo blkid ## Get the UUID
sudo hdparm -B /dev/disk/by-uuid/

Not available

/dev/disk/by-uuid/
 APM_level  = not supported  ## You can NOT use this method

Disabled

dev/disk/by-uuid/
APM_level   = off  ## It is disabled and can be set

Activate it (241 for 30 minutes) (242 for 1 hour)

sudo hdparm -S 241 /dev/disk/by-uuid/

Activate it permanently in /etc/hdparm.conf

/dev/disk/by-uuid/ {
  spindown_time = 241
}

drivetemp kernel module

drivetemp reports S.M.A.R.T. temperatures to userspace (sensors) without root.

Temporal

sudo modprobe drivetemp

Permanent

/etc/modules-load.d/drivetemp.conf
---
drivetemp

They are exposed in /sys/class/hwmon/

S.M.A.R.T.

smartmontools

Show

sudo smartctl -a /dev/nvme0
sudo smartctl -a /dev/nvme0 | grep Temperature: | awk '{print $2}'

Test

sudo smartctl -t conveyance /dev/sdb
sudo smartctl -t short /dev/disk/by-uuid/1234-56AB
sudo smartctl -t long /dev/sdb
sudo smartctl -t extended /dev/sdb

LVM

Change the size of an lv

  • Set it to 1G: lvreduce --resizefs -L 1G vg00/lvol1
  • Reduceit 1G: lvreduce --resizefs -L -1G vg00/lvol1
  • Extendit to the max: lvextend -l +100%FREE vg00/lvol1

XFS

Grow XFS partition

  • Extendit to the max: xfs_growfs /mount/point