This is my main work machine for video editing, streaming, VMs, etc.
I want to replace the primary NVME 1TB drive with a 2TB drive. In my search across this forum and Reddit, I’ve found several methods and some conflicting information. One person will say one method is the best, while another person will say that same method is the worst and “dangerous” etc.
So, I’m here to upgrade my drive but also to learn. I’ve seen 3 approaches:
Install the new drive, do a fresh Manjaro install, then use rsync to copy all your files from the old drive mounted in an external enclosure.
That sounds easy enough, but do I rsync the entire drive or just my home directory? And if just my home directory, isn’t it going to be a big chore to get everything else working with all the files that aren’t in my home directory?
Use dd to clone the old drive to the new one. Swap drives and boot into the new drive.
This is the only one I have experience with. I’ve used dd to clone an old HDD to a new SSD on a Windows computer. I also use dd every time I want to make a new Manjaro USB installer. I’ve seen people on Reddit say this method is “dangerous” but unless you make a typo in your dd command and accidentally erase your primary drive, I don’t see why it’s “dangerous”. Am I missing something?
Use btrfs replace (and some additional steps)
The problem here is that I’m unfamiliar with this command and the other steps that are necessary. If this is indeed the best method of the 3, then I’m happy to learn. But when I was reading threads of people using this method, it also seemed like it was the one most prone to mistakes, forgetting a step, etc.
Make a list of all installed packages:
1.1. All official packages from the repository:
pamac list --installed --quiet --explicitly-installed > ~/installed.txt
1.2. All foreign packages, like the AUR:
pamac list --installed --quiet --explicitly-installed --foreign > ~/installed-foreign.txt
Disconnect the current disk.
(Re)connect the new disc, leaving the current one disconnected.
Install Manjaro on the new, connected disk and make sure it’s bootable and everything is good.
Connect the current one along with the new one, but be sure to boot from the new disk.
Copy the current, now the older, previous drive’s home directory tp the new user’s.
cp /mnt/<old_disk>/home/<userName>/* ~/
Where:
/mnt/<old_disk> is the mount point where the previous disk is mounted; and
<userName> is the username of your current user on the older, previous installation.
When done, reinstall all packages from the list previously backed up:
For the packages from the repositories:
pamac install $(cat ~/installed.txt)
For the foreign packages:
pamac build $(cat ~/installed-foreign.txt)
Of course, I don’t know if this’ll install any snaps or flatpaks currently in use, as I don’t have any so can’t test. But that’d be my steps. Also: this method can work with/on any file system, be it BTRFS, FAT, EXT4, or something else entirely.
and:
with BTRFS, you not only do not need dd
not least because it has got it’s own tool set to do just that. dd cloning (from a smaller to a larger drive, no less) will probably destroy your data on both drives
(there is a good potential for it anyway)
What I’d do (and have done many times):
partition the drive as you want it and use a usb booted iso to transfer the content of the old to the new rsync or simple cp -a - the tool used doesn’t matter-
reinstall bootloader and adapt /etc/fstab - done
This thread already looks like it’s going to be fun for OP to figure out what to choose out of the multitude of opinions.
CloneZilla to clone the full disk. Many bootable ISOs contain CloneZilla; or it can be installed to memory when booting from a Manjaro Live Installer.
Restore the image to the new M.2. (Again, using Clonezilla)
Resize your /home partion to fill the remaining capacity; or carefully resize / if /home isn’t separate.
Possibly recreate swap space in the process.
I typically use the PartedMagic which contains CloneZilla, GParted, and many other tools that I might typically need.
If you mess something up, you still have the image to do it again. The only downside to this procedure is that you need another sizable disk (USB maybe) to temporarily store the cloned image.
Otherwise, cloning is also possible via GParted.
Hope this helps. Cheers.
Edit:- I’ll just add that with CloneZilla it’s also possible to clone directly from disk to disk; in this case the need for temporary image storage is negated. That said, having a cloned image available (just in case) would still be my preference.
This command copies the full drive? You plug both drives and make something like sudo cp -RPp /dev/sda /dev/sdb? Booting from one drive or from a pendrive? Never used cp to clone drives and I’m curious about it.
Yes, it copies the whole drive. Just mount them both and copy to and from mountoints, don’t use /dev syntax.
Then adjust fstab to the partitions of the new drive and check /etc/default/grub also.
Those cp options will retain permissions and copy links as links (it doesn’t follow the links). Usually, I do this from the live system, because if you mount the new drive in the system contained in the old drive, you will have a loop condition because that command will try to copy contents from the mounted dir into itself. One way to avoid this it to add the -x option, which will copy only content from the same filesystem, but I prefer to mount both drives in a live system to avoid problems.
I was wondering why cp -RPp was used instead of cp -a
but the effect would be the same, I guess - I always used the latter.
You boot the iso with both drives connected,
mount one to /mnt/source
the other to /mnt/destination
and then cp -a /mnt/source/* /mnt/destination
Of course, if there are several partitions,
assemble them first below the respective mountpoint, which you also first have to create: mkdir /mnt/source
…
like: mount /dev/sda2 /mnt/source mount /dev/sda1 /mnt/source/boot
if you have two partitions, one / and one /boot …
I’d, in this case, not use sudo, but would sudo su to get root and then not need sudo anymore during the operation.
With rsync, you have the --progress option
also possible to do with cp but a helper program is needed to get some feedback as far as I remember.
Using the copy command (cp) will copy the contents of one partition to another; however, this will require creating the partitions on the new NVMe beforehand.
This would be fine for copying contents of /home I imagine, but an entire disk? The better way using that method would be to install a fresh Manjaro to the new NVMe and then copy the contents of /home to the new/home (directory or partition).
I don’t think this is what the OP wants; if I read correctly; they want to move their current working installation to the new NVMe. Cloning is arguably the most reliable way to do that.
If cloning works from a smaller to a larger disk without having to then adjust the partition sizes afterwards, then yes.
I mentioned to create the partitions as wanted/needed - and then a simple copy operation
and you have the very same system with all configurations to /etc (except /etc/fstab)
on the new disk.
This is all very different if the file system is BTRFS.
Cloning does just that. A partition would still need to be extended - it it’s a /home partition, that’s relatively easy; only if it’s / should extra care be taken (to only resize from the end not the start of the partition). Otherwise, it’s non-destructive.
Again, cloning will faithfully copy all partitions and data from
That said, it’s also possible to clone one partition at a time with CloneZilla - so, the $ESP, / and /home (if separate) - and restore each image one by one.
Despite all of the above, I’d personally favour a complete new installation on the new disk, and simply copy /home when done; but, that’s just me.
And that is exactly why I’d rather do it in the way I described,
because that gives one the opportunity to create the partitions in the sizes that is desired on the new disk
(more space for one, less for the other, change the layout … or even separate /home from the rest, even if it was all on one partition before)
… instead of essentially copying everything once, and then once more when adjusting the partition sizes
It’s just quicker and (for me) easier.
But this is just my preference.
Well, my preference is noted at the end of my previous comment; though a full clone is equally tried and true. It just depends what the OP is most comfortable with.