I have Fedora and Windows installed in the same drive in my laptop. The drive has 512GB and it’s divided so that each OS has 256GB. Fedora’s partition is encrypted using the option it shows in its installer.

Problem is I’m running out of space. I’m considering getting a 1TB drive on which I would move Fedora and then giving Windows the other drive, so on the whole the laptop would run Windows on the 512GB drive and Fedora on the 1TB one. I’ve already read lots of forums but am still unsure on how to do this without losing any data and messing with Grub (I’ve had some bad experiences previously). So any help would be appreciated.

  • @YukiA
    link
    186 months ago

    Can’t you just clone the entire disk to a bigger one and then enlarge the partitions you want enlarged ?

    • JustEnoughDucks
      link
      fedilink
      8
      edit-2
      6 months ago

      I did this exact thing with my server. Fully encrypted with a boot partition on a USB.

      Clonezilla from my encrypted SSD to another (you can also decrypt it with clonezilla before the copy if you want)

      Expanded the LVM volumes

      Viola, 120GB to 500GB. Spun up the docker containers and everything just worked again

      • @k2helix@lemmy.worldOP
        link
        fedilink
        15 months ago

        This is the first thing I thought. However I’m concerned about grub not recognising my partitions and causing my laptop to basically not boot. Did you have any problem with this? Also, if you copied the encrypted drive and kept it encrypted, was there any change you had to do?

    • krolden
      link
      fedilink
      06 months ago

      If you do that youll have to also update the uuids in /etc/fstab to match the new drive.

        • krolden
          link
          fedilink
          15 months ago

          Theyre gonna have to recreate the partitions anyway since I believe they stated they are not keeping windows.

      • @YukiA
        link
        26 months ago

        Ah yes but that’s it AFAIK

      • @ShortN0te@lemmy.ml
        link
        fedilink
        15 months ago

        Only if you delete the partitions and create them new on the same blocks.

        If you enlarge them, you should be fine.

  • SayCyberOnceMore
    link
    fedilink
    English
    35 months ago

    Whatever you do. Full backup first 👍🏻😉

    Personally, I’d go with the clean Fedora install on the new drive and copy your data over as someone else mentioned, then expand Windows once you 100% happy with it.

    (I did something similar with WinXP years ago… eventually dropping Windows, so that harddrive just became a data drive)

    • @k2helix@lemmy.worldOP
      link
      fedilink
      25 months ago

      I think I’ll take a backup then try to clone the disk with btrfs send/receive and keep that as a solution in case something goes wrong. Thanks for answering!

  • krolden
    link
    fedilink
    36 months ago

    Replace the ssd in your laptop and install fedora, set it up with the same user account name and password as your old setup. Then cp -rvp your home directory from the old drive into your newly created home dir (best to do this from your old install and make sure the uid matches with your old one) on the new ssd. Pick and choose what /etc configs you want to save etc.

    Youll have to reinstall whatever applications you use. There may be some issues with KDE stuff or other config tweaks youll need to do but you should be fine.

    You could attempt to clone your entire rootfs but its generally better to start fresh if you can.

  • @makeasnek@lemmy.ml
    link
    fedilink
    English
    25 months ago

    Instead of trying to clone, it may be easier to:

    • Install Fedora to new drive
    • Reinstall any packages you modified from base install
    • Copy over your home directory including hidden directories, plus /etc
  • arran 🇦🇺
    link
    fedilink
    15 months ago

    There are several ways of doing this, but you have to be wary of how grub is configured to boot off the disks, and how your /etc/fstab is configured.

    The simplest way probably is to just put the old ssd in a USB case, boot off a live usb/cd, then dd the disk (make sure you do it the right way around or there will be tears), then reboot. There are a couple ways this could fail still depending on config, but you can always put the old disk in if it does. Then once you’re in the system you can use tools like parted/kde partition manager to resize the volumes once decrypted. – And you will have your old disk as a backup the entire process.

    If you want to get more comfortable with this type of work install arch / gentoo and you will learn more of the underline processes making you more confident.

  • @k2helix@lemmy.worldOP
    link
    fedilink
    1
    edit-2
    5 months ago

    Here’s what I ended up doing:

    When the SSD arrived, I put it in the 2nd slot. Then, I booted Ubuntu in a Live USB and created the same partition layout in the new disk with parted.

    1. Create the EFI partition and give it the same size
    2. Do the same for the ext4 boot partition
    3. Create a btrfs partition and give it the remaining size.
    4. Encrypt this new partition with cryptsetup and mount it with the option luksOpen of cryptsetup.

    Next thing was mounting the partitions of the old drive. And now, to clone the disk I first tried with brtfs-clone but as the size of what first were 220 GB increased to 260 GB, I tried just using btrfs send from the old disk and piping it to btrfs receive to the new disk. However the size didn’t change and still was 260GB, no idea why. I didn’t use dd because some comments recommended btrfs send/receive as it doesn’t copy the whole partition including empty space.

    Once that was done I copied the /boot/efi and /boot partitions using cp and changed the uuids in /etc/fstab and /etc/crypttab to match the new partitions UUIDs (to know which UUID was each partition, I just used blkid and grep’ed the type of partition. For instance if I was looking for the new partition to replace the one with UUID a1b2c3, I would just use blkid | grep a1b2c3 and if it said it was a crypto partition, then blkid | grep crypto). Finally I deleted the Microsoft folder from /boot/efi as I would only use that disk for Linux.

    So then I tried booting from that disk (and removed the other) but Grub was a mess - it just showed the command line. After some (stressful) hours, I found out that it was because Grub itself when first installed saves the UUID of the disk where the config is and searches for it there - so it was not using the config in the new drive.

    Again, booted Ubuntu and mounted the new drive partitions. There I tried to just reinstall Grub in the boot partition but it seemed impossible because of some weird errors. So I just changed the UUIDs in Grub related files such as /boot/grub/grub.cfg and /etc/default/grub.

    Tried booting again but as noticed earlier Grub was not loading the config file I edited, it was still trying to use the old one in the old drive which was removed and had the original UUIDs. Maybe just changing the UUIDs there would have done the trick but I didn’t try.

    It was in that moment that I discovered the existence of configfile - a command that can be used from Grub’s shell to boot with the specified config file. Then I used configfile disk_and_path_to_grubcfg and bang! The OS selection screen appeared. At that time I had already put the old disk in the other slot as I thought everything was solved.

    To my surprise, when I selected to boot fedora and typed my password to decrypt the drive, I booted to Fedora in the old drive! How could that be, if I really made sure that I was booting Grub from the new disk? So now the problem was that I was booting Grub (manually with configfile) from the new disk but the OS I was booting was in the old one.

    After some time researching, the culprit was that while I changed the UUIDs in the grub.cfg config file, Fedora doesn’t add its kernel entries to that file but to the /boot/loader/entries directory. And there were the files I had to modify (just replacing the old UUIDs). One reboot (maybe also update-grub to update Grub config) and that was it, solved.

    However there was one more thing to do. As I didn’t want to use the configfile command every time I boot, I just reinstalled grub.

    So that was it. Hope it is useful for anyone who needs to do the same. Although the story doesn’t end there, because the new drive turned out to be defective and I had to order a new one to which I dd’ed (not going through all that again). You live and you learn!

  • @dingdongitsabear@lemmy.ml
    link
    fedilink
    -1
    edit-2
    6 months ago

    look up btrfs send and receive. you’ll be copying data from the old disk to the new. prior to that you create the same layout on the new disk (efi, boot, btrfs with LUKS, subvolumes root and home). sadly, there aren’t any readymade solutions that do this for you. big time NO on clonezilla and friends.

    • @k2helix@lemmy.worldOP
      link
      fedilink
      1
      edit-2
      5 months ago

      Thanks for your answer. Would Grub still see everything as usual or is any change needed too? Also how would I go about having the same exact layout? Use the Fedora Installer on the new drive and put the same password for encryption, creating the same partitions and giving them the same size?

      big time NO on clonezilla and friends.

      Can you explain? Another comment recommended clonezilla. I remember reading something like this, but knowing more would be nice.

      • @dingdongitsabear@lemmy.ml
        link
        fedilink
        25 months ago

        CZ and dd and other “it’s 1998” tools copy the entire disk. like, you clone a 500 GB SSD with 50 GB used to another disk, guess how much data gets copied? correctomundo, the entire 500 gigs. that’s not super-healthy for the new drive and it recreates the same volume UUIDs on the target disk as the source drive, so you’re left with a mess if you keep both drives in a system.

        you have a modern tool at your disposal, the mentioned btrfs send subvol | btrfs receive subvol that copies only what’s used. GRUB (you can use this opportunity to switch to systemd-boot) won’t pick up shit, you need to install it to the new drive (and remove it from the old one).

        eons ago, macOS had the SuperDuper! tool, a free utility that clones the entire disk, resizing the partition in the process and copies only the data and it does that from within the OS, no booting off USB installers and such. sad to say, nothing close exists over here, you’ll just have to get good at doing things manually.

        • @k2helix@lemmy.worldOP
          link
          fedilink
          1
          edit-2
          5 months ago

          I see, I like this approach. However as Fedora installs Grub (and I don’t want to have a headache), I think I’ll stick with it. Thanks for sharing all your knowledge!