Рубрики
File system Linux

File systems

Check what is the logging type is used in the filesystem:

dmesg | grep EXT

If you need to change logging type remount partition with data=xxx specified (mount command or /etc/fstab) where xxx can be:
data=ordered
data=writeback
data=journal


data=ordered — first metadata is saved only then real data will be written to disk and confirmed as saved. (reliable but slower writeback)

data=writeback — async logging, saving data can be confirmed before real data is saved, software should end operations based on POSIX spec with fsync command.

data=journal — saving both metadata and data itself (slow)

Change file system fsck check period:

tune2fs -l /dev/sdb1 show current information
tune2fs -c 150 -i 80 /dev/sdb1 change it to 150 mount/remount operations («-c») or 80 days («-i»).

Manually recheck file system:
umount /dev/sdb1
fsck.ext4 -f /dev/sdb1
mount /dev/sdb1

Generate UUID for the file system:

tune2fs -U random /dev/sdb1 Generate random UUID

tune2fs -U 5cf24d64-b279-4565-9bfd-e6ec3436845b /dev/sdb1 Set exact UUID for FS

Check the current UUID:
blkid

Extend LVM volume and FS on it (to 30G):
lvextend -L 30G /dev/mapper/vg1-test
resize2fs /dev/mapper/vg1-test

1 st step expand the disk.
in VMware or another hypervisor.

2nd step:
Re-scan expanded disk on a fly (for example expanded vmware para-virtual drive):
echo "1" > /sys/class/block/sdX/device/rescan

3rd step:
resize the partition using fdisk

fdisk /dev/sdX

Delete partition:
Command (m for help): d
Selected partition 1
Partition 1 is deleted

Create a new primary partition:
Command (m for help): n
Select (default p):
Using default response p

Write changes to disk:
Command (m for help): w
The partition table has been altered!

Rescan partitions:
#partprobe

4th step:
check type of filesystem with blkid
if filesystem id «xfs»
to expand partition use:
#xfs_growfs -d /dev/sdX1

check new «xfs» file system info:
xfs_info /dev/sdX1

If the partition is GPT:
use
#partprobe
if you see an error similar to this:
Error: The backup GPT table is not at the end of the disk, as it should be.
Fix partition at first:
parted -l
fix
fix

Now you can use fdisk to recreate the partition:
#fdisk /dev/sdX
d
n
w


Resize file system (ext4)
resize2fs /dev/sdX1

Done

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.