• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

partition

Extend Linux Boot

February 6, 2019

The following commands will extend Linux Boot drive without a reboot.

List block devices. Check disk sizes.

lsblk
df -h

lsblk df -h

Determine file system type: xfs, ext2, ext3 or ext4.

file -s /dev/xvda1
# or
df -Th

file -s /dev/xvda1 # or df -Th

Extend volume from the console or command line.

aws ec2 modify-volume --region us-east-1 \
--volume-id vol-xxxxxxxxxxxx --size 10 \
--volume-type gp2

aws ec2 modify-volume --region us-east-1 \ --volume-id vol-xxxxxxxxxxxx --size 10 \ --volume-type gp2

Resize Linux partition.

# for /dev/xvda1
growpart /dev/xvda 1
# for /dev/xvda2
growpart /dev/xvda 2
# for ext2, ext3, ext4
resize2fs /dev/xvda1
# for xfs 
xfs_growfs /dev/mapper/root
xfs_growfs /dev/xvda1

# for /dev/xvda1 growpart /dev/xvda 1 # for /dev/xvda2 growpart /dev/xvda 2 # for ext2, ext3, ext4 resize2fs /dev/xvda1 # for xfs xfs_growfs /dev/mapper/root xfs_growfs /dev/xvda1

Check if new file size is being displayed.

lsblk
df -Th

lsblk df -Th

Filed Under: Linux Tagged With: boot, extend, partition

Not Marked For Formatting

March 1, 2017

I have a Linux box with a 1TB drive. I divided it into 4 different partitions at 250GB each. It’s currently running Linux Mint, Gitlab, Nextcloud and the Unifi Cloud Controller on each partition. Obviously, I can’t run all 4 partitions at the same time. I have to choose one from a selection in the Grub, a multi-boot loader. It would have been easier to run Virtualbox on just one Linux install, but it’s older CPU. I don’t think it could handle multiple OS running at the same time.

Unfortunately, one of the partitions got corrupted. I tried running the utility called badblocks to figure out if there are any bad sectors on the drive that can be marked bad, but the test result turned out to be surprisingly good. There were absolutely no errors and no bad blocks. Next, I tried using the recovery process, but that didn’t work either. It seems the only way to fix the problem was to reinstall Linux. A bummer.

During the install, I ran into the problem with the partition not being properly marked for formatting. It seems the only way to get around that issue was to delete the partition and to repartition it. Nevertheless, it would have been an interesting dilemma if I had any important data on that partition. It’s a good thing that I didn’t. So, if you ever get into a problem where it says “your partition is not marked for formatting”, you may have to go through the process of deleting the partition and then recreating one, in order to proceed with a fresh install.

Filed Under: Linux Tagged With: formatting, partition

  • Home
  • About
  • Archives

Copyright © 2023