3

My filesystem:

$ df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 9.8G     0  9.8G   0% /dev
tmpfs                    9.8G   18M  9.8G   1% /dev/shm
tmpfs                    9.8G  1.8M  9.8G   1% /run
tmpfs                    9.8G     0  9.8G   0% /sys/fs/cgroup
/dev/mapper/fedora-root   49G   14G   33G  30% /
tmpfs                    9.8G  160K  9.8G   1% /tmp
/dev/nvme0n1p5           976M  195M  715M  22% /boot
/dev/mapper/fedora-home   37G   28G  6.3G  82% /home
/dev/nvme0n1p1           256M   47M  210M  19% /boot/efi
tmpfs                    2.0G   12M  2.0G   1% /run/user/1000

The gnome-app 'Disks' show that I have a 400gb unused free space on /dev/nvme0n1.

How can I add those 400GB to my home partion, so that /dev/mappe/fedora-home will become 437 GB.

I use disk encryption (LUKS) and Fedora 29

EDIT

Parted -l

Output of sudo parted -l below:

Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system  Name                          Flags
 1      1049kB  274MB  273MB   fat32        EFI System Partition          boot, hidden, esp
 2      274MB   290MB  16.8MB               Microsoft reserved partition  msftres
 5      406GB   407GB  1074MB  ext4
 6      407GB   511GB  104GB
 4      511GB   512GB  1049MB  ntfs         Basic data partition          hidden, diag

lsbl

$ lsblk
NAME                                        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
nvme0n1                                     259:0    0  477G  0 disk  
├─nvme0n1p1                                 259:1    0  260M  0 part  /boot/efi
├─nvme0n1p2                                 259:2    0   16M  0 part  
├─nvme0n1p4                                 259:4    0 1000M  0 part  
├─nvme0n1p5                                 259:5    0    1G  0 part  /boot
└─nvme0n1p6                                 259:6    0 96.7G  0 part  
  └─luks-29414c5a-13ed-4ddb-9403-8aa5d983fd4f
                                            253:0    0 96.7G  0 crypt 
    ├─fedora-root                           253:1    0   50G  0 lvm   /
    ├─fedora-swap                           253:2    0  9.8G  0 lvm   [SWAP]
    └─fedora-home                           253:3    0 36.9G  0 lvm   /home

EDIT 2

Thanks to the answer from @frostschutz I have some follow up / understanding questions.

My understading

From lsblk I can see the whole device and its partitions From parted -lI can see the contents of each used partion.

So from lsblk I can see that nvme0n1 has a total size of 477 GB. That disk has 6 partions. I can see that partion 6 is the luks encrypted container with three mountpoints.

The partitionnumber correspond to the output of parted

So:

  • nvme0n1p1 = 260M is EFI boot (this I can se from parted -l)
  • nvme0n1p2 = 16M is Microsoft reserved (I guess a recovery partition)
  • nvme0n1p3 is missing. We can sort of deduce that there is 400 GB here - but not quite. we have 477G - 260M -16M - 1000M - 1G - 96.7G = 378G
  • nvme0n1p4 = Basic data patitio, Ntfs - probably old windows - but hidden? Dont know what this is
  • nvme0n1p5 = Boot,I guess this is for linux grub?
  • nvme0n1p6 = the fedora install, encrypted with luks lvm container.

lsblk also shows me that I have 'room' from where partion 2 ends (290 MB) to partion 3 begins (406 GB).

My follow up questions

I can see that parted and lsblk disagrees about partion size? Parted says partion 6 is 104GB. lsblk says partion 6 is 96.7 GB

gnome program disk says I have 406 GB available. Calculating total size minus used partions as reported from lsblk says I have ca. 378G Looking at parted I have 406G minus 290M - so mayby 405

1: Which reported size should I trust?. Or rather why is lsblk reporting the wrong size? The difference seems to be larger than any difference from G (base 10) and GB (base 2?) -but is that it?

I understand how I create partition 3. I guess you randomly assign it 9 MB so we get a round number. boot is today 1 GB - you assign newboot ca. 900 MB - as per my output of df this is plenty. root is today 96.7 GB you assign it (200G minu 1200M) ca. 199G - because why not have plenty of space?

2: Is this correct?

I understand how to copy the data via dd.

I understand that you now want to delete partion 5 (old boot - just copied to 7), partion 6 (the one that does not exists?) partion 7 and 8 (newboot and newroot? - but we just created andcopied theese?)

3: So I dont understand why we delete theese new partions? Or is it only the numbering that gets removed?

4: *I don't understand why you create newboot and newroot again? It seems to me we create it, we copy data to it, we delete and we create it? If its not deleted (as per question 3) then why create it again?

The way I read it:I understand that the resize command afterwards expands the partion to the 511 GB spot.

But I dont think I have any data now? Where am I misunderstanding?

EDIT 3

When I get this far, later on, I will need to look into pvresize, lvextend and resize2fs.

  • show partitions, e.g. parted -l – frostschutz Mar 30 at 22:03
  • Hi @frostschutz- output added – Andreas Mar 30 at 22:22
  • Also add the output of lsblk. – Emmanuel Rosa Mar 31 at 0:53
  • Hi @EmmanuelRosa - output added – Andreas Mar 31 at 7:26
  • If you can get hold of a 100 GB external storage if be very tempted to suggest you backup your data, erase the NVME, and reinstall from scratch. (You'll need to backup your data before moving the partitions anyway,.) – roaima Apr 1 at 8:23
1

So you have an unpartitioned gap of roughly 400GB in the middle of your disk (missing partition number 3). This gap is followed by your /boot partition (5) and a LUKS encrypted partition (6) with your fedora install inside. So you have partitions 1, 2, (3 missing), 5, 6, 4.

In this case I would boot a Live CD (don't mount anything) and move the partitions 5, 6 then grow partition 6. Partitions 1, 2, and 4 to be left untouched. This can roughly(!) be done like this:

# parted /dev/nvme0n1 mkpart unused3 290MiB 299MiB  # should be 3
# parted /dev/nvme0n1 mkpart newboot 300MiB 1199MiB # should be 7
# parted /dev/nvme0n1 mkpart newroot 1200MiB 200GiB # should be 8

This creates a partition number 3 (just to reserve the number), and two new partitions 7 and 8 to replace 5 and 6. It can only be done this way since your partition gap is large enough to contain both boot and root partitions.

Copy data over:

# dd status=progress bs=1M if=/dev/nvme0n1p5 of=/dev/disk/by-partlabel/newboot
# dd status=progress bs=1M if=/dev/nvme0n1p6 of=/dev/disk/by-partlabel/newroot

Only proceed if both copies were made successfully. If there was any problem up to here, delete the newboot and newroot partitions before rebooting, or you will run into UUID conflicts.

Restore the original partition numbering and grow to size:

# parted /dev/nvme0n1 rm 5 rm 6 rm 7 rm 8
# parted /dev/nvme0n1 mkpart newboot 300MiB 1199MiB # previously 7 now 5
# parted /dev/nvme0n1 mkpart newroot 1200MiB 200GiB # previously 8 now 6
# parted /dev/nvme0n1 resizepart 6 511GB

And after reboot, all that's left is pvresize, lvextend, resize2fs, ... normal grow operation as you see fit.

Note: Verify every step with parted /dev/nvme0n1 unit mib print free or similar method. The commands above are all untested (since I can't easily replicate your situation just now). It's how it should work in theory but you may have to adapt in practice. Make a backup of your data first so if anything goes wrong you can just reinstall.

The alternative would be to just re-create the missing partition 3, luksFormat it, and add to your LVM. That way no data has to be moved, however every time you boot you have to open two LUKS containers instead of just one.

You can also try to move the partitions with gparted instead of doing it manually in the terminal. I never use that program myself so I don't know how well it can handle LUKS containers and the like.

  • Thanks a lot.Very clear help. The way I read it, though,we create a new partion 7, copys old data to partiotion 7. Then deletes partion 7, and create a new partion (which is now partion 5)... I dont understand that step. Se my latest edit. – Andreas Apr 1 at 6:41
  • "restore the original partition numbering", so partition 7 is changed to partition 5. Otherwise with changed numbers you might have to adapt some configs. Parted does not allow to change numbering directly so delete and re-create it is. You have to take care to use the same start sector on re-create. – frostschutz Apr 1 at 6:48
  • The other values is just a difference of MB (1000*1000 byte) vs. MiB (1024*1024 byte). Feel free to adapt the sizes to your liking but stick to MiB unit. – frostschutz Apr 1 at 6:49
  • pertaining to:"restore the original partition numbering", so partition 7 is changed to partition 5.... Is this because parted doesn't delete the data, but only creates 'meta' data about partitions? So while I delete "partition 7", I don't delete the actual data that I just copied (with dd) to the blocks in the range 300MiB 1199MiB? Then it makes sense. Is that correct? – Andreas Apr 1 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.