Ask Your Question
1

Resize boot partition on /dev/sda?

asked 2015-08-06 11:45:18 -0500

AustinW gravatar image

updated 2015-08-07 00:18:23 -0500

Hey guys, I'm currently triple booting (Windows 8.1, Fedora 22, and KUbuntu 15.04) on my laptop, and I want to add another partition in. However, when I installed Fedora, it seemed to have taken up all the room on /dev/sda. The others take up about 500MiB each, while Fedora is taking up 21.38GiB. AND it says it's using everything, so I can't decrease the size. Here is the printout for 'fdisk -l'. I can't attach an image because apparently I don't have enough points, but it shows the same thing, and that the entire 21.38GiB is being used (exactly 4.00MiB is unused). How should I do this without breaking my partition? Thanks!

Disk /dev/sda: 22.4 GiB, 24015495168 bytes, 46905264 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: gpt

Disk identifier: EE84BBD6-E974-4B27-92A3-98C18395A5B1

-------------------------------
Device       Start      End  Sectors  Size Type


/dev/sda1     2048  1050623  1048576  512M EFI System

/dev/sda2  1050624  2074623  1024000  500M Linux filesystem

/dev/sda3  2074624 46903295 44828672 21.4G Linux LVM
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2015-08-06 13:06:19 -0500

BRPocock gravatar image

I'm assuming that you mean, that the Fedora LVM partition is using all the free space on the device, but that the filesystem on that volume is not full.

So, the filesystem containing your files has free space; as per df -h report; but the filesystem (FS), let's assume /, is on a logical volume (LV), let's say /dev/mapper/fedora-root, is on a volume group (VG) which we'll say is fedora, which in turn is using only the one device partition as a physical volume (PV), /dev/sda3, which in turn is filling the balance of space on the physical device /dev/sda. I'm further assuming that your root filesystem is ext4 (or ext2 or ext3) and not one of the more exotic options like btrfs or xfs. mount | grep 'on / ' will show you for sure, as will Gnome Disks. (“Contents: Ext4 (version 1.0)” or similar.)

You can adjust these things, but you'll have to boot from the LiveCD to do so — you can't reduce the size of a volume that is mounted, and you can't unmount /.

The “trick” here is, you have to reduce the size of each of the parts of that stack in order: FS and LV, then VG and PV (partition). If you do them out-of-order, you'll have “random” parts of your filesystem that get cut off. The tools are pretty good about warning you about that, and even trying to stop you from hurting yourself, but caveat, beware.

First, boot from a LiveCD/LiveUSB and get to a Terminal, then type sudo -s for superuser privileges.

Make sure your LVM volumes are recognized: type lvm lvs and you should see your logical volume. The mapper name will be the volume group - the logical volume name. ls /dev/mapper to check for its precise name; if it has punctuation or something, it may be “encoded” a bit, there,

Then, make sure the filesystem isn't borked in some way to begin with. fsck -f /dev/mapper/your-vg-your-lv (and go get a coffee).

Luckily, you can resize the FS and LV together. lvm lvresize --verbose --resizefs -L 10G /dev/mapper/vgname-lvname for example. (To specify instead to reduce it by a certain amount, use -L -5G or similar, ie, a negative number.)

This will take a while; and if you (eg) pull the plug, Very Bad Things will happen. Replace 10G with your target size. (Note, it means 10 GiB, not 10 GB. 1 GiB = 1,073,741,824 bytes, 1GB = 1,000,000,000 bytes. Hard disks are sold in GB, not GiB; sadly, a lot of tools still use the two units interchangeably.)

This next part is only needed if your new OS doesn't understand LVM. If you're installing, say, Red Hat or Ubuntu, you can add a new LV to the same VG, and all is well. If you're installing, say, Haiku OS, continue:

Once the LV is resized, your ... (more)

edit flag offensive delete link more

Comments

Thanks for the detailed response! You're correct in your assumptions. I'll back up all my partitions and then give this a try!

AustinW gravatar imageAustinW ( 2015-08-06 13:10:59 -0500 )edit

Fedora 27 user here(Recent;y switched, know nothing of the command line except the ls command

Hello, BRPopcock, I, uh, panicked that the resizing was taking too long and quit it. The load icon is still there on my device but nothing is really happening. When I try to stop it again, it says "Job has already been cancelled (udisks-error-quark, 2)

Tejas Garhewal gravatar imageTejas Garhewal ( 2017-12-16 06:43:29 -0500 )edit
1

answered 2015-08-06 13:12:22 -0500

baoboa gravatar image

use gparted from a livecd (f22) , the newer versions work with lvm

edit flag offensive delete link more

Comments

I have heard that this is also true, but couldn't find detailed instructions. +1

BRPocock gravatar imageBRPocock ( 2015-08-06 13:13:16 -0500 )edit
baoboa gravatar imagebaoboa ( 2015-08-06 13:19:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-06 11:45:18 -0500

Seen: 4,054 times

Last updated: Aug 07 '15