Skip to content

Disks

Extend a standard partition Online

Rescan the disk after resizing

echo "1" > /sys/class/block/sdb/device/rescan

Extend partition with growpart

growpart /dev/sdb 1

Extend ext2/3/4 filesystem

resize2fs /dev/sdb1

Extend xfs filesystem

xfs_growfs /dev/sdb1

Extend a LVM Volume Online

Rescan the disk after resizing

echo "1" > /sys/class/block/sdb/device/rescan

Extend partition with growpart if LVM is on a partition

growpart /dev/sdb 1

Resize Physical Volume

pvresize /dev/sdb1

Resize Logical Volume to full size

lvextend -l +100%FREE /dev/my-vg/my-lv

Extend ext2/3/4 filesystem

resize2fs /dev/sdb1

Extend xfs filesystem

xfs_growfs /dev/sdb1

Extend a Standard partition with parted

Rescan the disk after resizing

echo "1" > /sys/class/block/sdb/device/rescan

Extend partition with parted

parted -a optimal -s /dev/sdb resizepart 1 '100%'
If an error occurs that the blocks doesnt fit open parted an accept to fix the blocks.

Extend ext2/3/4 filesystem

resize2fs /dev/sdb1

Extend xfs filesystem

xfs_growfs /dev/sdb1

Check all disks for faulty sectors

The below command checks all disks from /dev/sda to /dev/sdx for Offline_Uncorrectable and shows the results.

for i in /dev/sd[a-x]; do echo $i; smartctl -a $i | grep Offline_Uncorrectable;done

Locate local disk and mark it with the Disk LED

For the below command the packet ledmon is needed. Activate Disk LED

ledctl locate=/dev/sda

Dectivate Disk LED

ledctl locate_off=/dev/sda

Create a partition with parted that uses the full size

One Disk

parted /dev/sdf mklabel gpt mkpart primary 0% 100%

Bunch of disks

parted /dev/sd[a...z] mklabel gpt mkpart primary 0% 100%

or

for i in /dev/sd[a-z]; do parted $i mklabel gpt mkpart primary 0% 100%; done