I have been running debian for many years, and the initial partitions made to the disk are now no longer acceptable. I have a two TB disk that was partitioned 243MiB for /boot and the remainder for LVM. Over the past year or two kernel compiles run out of disk space on the boot partition. I have been limping along by moving the older initrd image off the boot partition before updating. I have plenty of free space in the LVM partition, and I would like to move a small portion (1G) to the boot partition. The disk uses MBR. The first partition is /dev/sdd1 using ext2 filesystem. The LVM file is lvm2 pv /dev/sdd5, which is wrapped in an extended filesystem /dev/sdd2. The LVM has two logical volumes, root & swap_1
I created a debian live cd and booted from it. I installed gparted and partitionmanager in the live cd. Some of the posts I found suggested that it might be possible to shrink the lvm in gparted or partitionmanager, but I did not find a way to do that. Instead I used the command line:
This seemed to do what I expected. But the unallocated space was "between" the two logical volumes. I moved the unallocated space to the end of the volume group by first determining where the logical volumes currently were located:
This gave the starting addresses and sizes of the segments as well as the 256 block unallocated segment.
This took the last 1G of the swap_1 logical volume and moved it into the 1G gap, which made the last 1G free.
I then used partitionmanager to shrink the sdd5 partition by 1G, and its containing sdd2 partition by 1G. This left me as pictured below
There is 2M of unallocated space under /dev/sdd2, which if I can't reclaim easily I will just ignore. I am guessing this is due to the sdd2 partition not being aligned, which I saw in a message.
There is also 1G of space that is not part of any partition at the end. Here I am stuck. I think I have to move that 1G space from after /dev/sdd2 to before it so it is adjacent to /dev/sdd1 (the boot partition). I was hoping to use partitionmanager or gparted to move the /dev/sdd2 partition (and its contained /dev/sdd5 partition) down, which would in turn move the unallocated 1G of space up. But both partitionmanager and gparted have a lock on the sdd2 and sdd5 partitions. I found something that says you use "Deactivate" in gparted to allow the partition to be moved, but I am concerned that deactivate===data loss. I can't find any documentation on what "deactivate" does.
So questions
1) Am I correct that the unallocated 1G currently located below partition /dev/sdd2 has to be moved above /dev/sdd2 and so next to /dev/sdd1 in order to expand /dev/sdd1 into the unallocated space?
2) Can this be done with gparted or partitionmanager without losing data?
3) Is deactivating the LVM partition in gparted the correct way to begin that process?
I created a debian live cd and booted from it. I installed gparted and partitionmanager in the live cd. Some of the posts I found suggested that it might be possible to shrink the lvm in gparted or partitionmanager, but I did not find a way to do that. Instead I used the command line:
Code:
lvresize --verbose --resizefs -L -1G /dev/mapper/euterpe--vg-root
Code:
pvs -v --segments
Code:
pvmove --alloc anywhere /dev/sdd5:476614-476869
I then used partitionmanager to shrink the sdd5 partition by 1G, and its containing sdd2 partition by 1G. This left me as pictured below
Code:
# parted /dev/sdd print freeModel: ATA ST2000DM006-2DM1 (scsi)Disk /dev/sdd: 2000GBSector size (logical/physical): 512B/4096BPartition Table: msdosDisk Flags: Number Start End Size Type File system Flags 32.3kB 1049kB 1016kB Free Space 1 1049kB 256MB 255MB primary ext2 boot 256MB 257MB 1048kB Free Space 2 257MB 1999GB 1999GB extended 5 257MB 1999GB 1999GB logical lvm 1999GB 1999GB 2097kB Free Space 1999GB 2000GB 1075MB Free Space
There is also 1G of space that is not part of any partition at the end. Here I am stuck. I think I have to move that 1G space from after /dev/sdd2 to before it so it is adjacent to /dev/sdd1 (the boot partition). I was hoping to use partitionmanager or gparted to move the /dev/sdd2 partition (and its contained /dev/sdd5 partition) down, which would in turn move the unallocated 1G of space up. But both partitionmanager and gparted have a lock on the sdd2 and sdd5 partitions. I found something that says you use "Deactivate" in gparted to allow the partition to be moved, but I am concerned that deactivate===data loss. I can't find any documentation on what "deactivate" does.
So questions
1) Am I correct that the unallocated 1G currently located below partition /dev/sdd2 has to be moved above /dev/sdd2 and so next to /dev/sdd1 in order to expand /dev/sdd1 into the unallocated space?
2) Can this be done with gparted or partitionmanager without losing data?
3) Is deactivating the LVM partition in gparted the correct way to begin that process?
Statistics: Posted by jrv — 2024-05-15 23:51 — Replies 0 — Views 16