Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minutes 2019-04-03

From MTU LUG Wiki

We are still looking for more people to run for e-board for next semester so far we have as nominations

  • President - Eric Steve
  • Server Team - Zach Jones

We will be doing elections next week so if you would want to run for a position com by next week's meeting Thursday at 5pm in Rekhi 101 feel free to bring a friend.

During our meeting I did a demonstration on how to manipulate partition size on a computer that uses an ext4 file system that does not use lvm. A copy of the procedure is attached for those that missed it. Next week we might go over something a bit more practical like setting up .bashrc file or your .nanorc file.

How to resize a file system without needing to copy from backup.

Reasons why to resize a file system?

  • Created a root file system that is too small for programs
  • want to remove a swap partition for a swap file
  • want to get rid of partitions that aren’t really needed for your use case ( such as if you had a separate partition for /var, /tmp, /boot, or /usr )

Before you begin

  • If unsure read the man page
  • Make a proper backup of critical data snapshots might not work because you are altering partitions and file systems
  • If you need to shrink root you will need to be on a different boot device such as a install media
  • Also this is for ext2/3/4 partitions without using lvm would potentially work for xfs with the exception that you should not shrink xfs

Shrinking a file system (where target_partition is the partition that is being made smaller)

umount partition if mounted, and shrink the file system to the minimum size, then check size we can use the df command for this and resize

e2fsck -f target_partition
resize2fs -M target_partition
mount target_partition
df -h
umount target_partiton

use your favourite tool the change the partition size to what you, make sure it is bigger that the file system size

Shifting the partition to a later part of the drive

use the sfdisk command and enter shift amount for example shift the partition 4G

sfdisk –move-data target_drive -N partition_number
+4G

or

echo “+size” | sfdisk –move-data target_drive -N partition_number

Expanding a file system (does not need to be unmounted)

alter partition table for it to grow in size

if unmounted run:

e2fsck -f target_partition
resize2fs target_partition