What's your preferred method for upgrading your system drive?

5 days ago by DampSquid to c/linux

Swapping out an old 2TB pcie 3 drive for a newer 2TB pcie 4 drive.
I was leaning towards using dd, after shrinking the partition on the source drive so it doesn't also 'copy' all the empty space.
Have you done this recently? What was your method?
Or is there a CachyOS/kde tool I may be unaware of?

treadful 28 points 5 days ago

For my personal workstation, it's such a rare thing I always use that an excuse to start from scratch again. If it's like a business system or something, usually build a new system and migrate data and services to it gradually.

I so rarely do in-place upgrades of system drives unless it's a recovery or something.

path: 0 25303475, hotness: undefined, score: 28, children: 3
Carl 4 points 5 days ago

Pretty much this. I’d copy anything I want to keep onto a temporary drive, (cloud storage, a USB drive, second SSD, etc), then use it as an excuse to refresh my install. Then just copy everything from that temporary storage after my new install is finished.

path: 0 25303475 25303962, hotness: undefined, score: 4, children: 0
njordomir 3 points 5 days ago

True. Starting with a fresh install can be more of a performance boost than buying a new drive. Add them together though and your computer is going to feel like future tech. I'd also just reinstall, unless its a server or a pain to rebuild.

path: 0 25303475 25304990, hotness: undefined, score: 3, children: 0
BeatTakeshi 3 points 5 days ago

I'm about to do just that, but a bit overwhelmed. Over the many years of using Debian (not a heavy user though, only some slow progressing self host projects), there are many utilities or programmes I installed that I wouldn't remember, is there an easy way to identify what is not "base" Debian and list them, so I'd reinstall them?

path: 0 25303475 25314583, hotness: undefined, score: 3, children: 0
deadbeef79000 13 points 5 days ago

Last time I did this I used btrfs.

Add the new drive to the system, create partitions, add the new volume and then remove the old one, btrfs moves all the blocks to the new drive.

The ESP partition is small enough and FAT- enough to just use cp.

path: 0 25303571, hotness: undefined, score: 13, children: 3
MentalEdge 6 points 5 days ago

Huh.

I never thought of using that feature of btrfs that way. Brilliant.

path: 0 25303571 25304195, hotness: undefined, score: 6, children: 2
DampSquid 3 points 5 days ago

Yeah, I think i'll give this a go

path: 0 25303571 25304195 25305379, hotness: undefined, score: 3, children: 1
MentalEdge 3 points 5 days ago

I would add that a slightly better way would be to do it in raid1 mode instead of single mode.

That way you can move the data over by running a balance, instead of by removing the old volume, which would survive the process being interrupted by a reboot or whatever else.

Then after the balance you can remove the old volume and turn the new one back into a single mode volume.

path: 0 25303571 25304195 25305379 25305468, hotness: undefined, score: 3, children: 0
PetteriPano 11 points 5 days ago

btrfs device add /dev/newdrive /

btrfs device remove /dev/olddrive

path: 0 25305330, hotness: undefined, score: 11, children: 0
eager_eagle 9 points 5 days ago

disk destroyer? I prefer just formatting and rsync-ing things. Unless I care about preserving metadata.

path: 0 25303355, hotness: undefined, score: 9, children: 2
yardy_sardley 3 points 5 days ago

rsync -a ftw

path: 0 25303355 25303980, hotness: undefined, score: 3, children: 1
dan 3 points 5 days ago

I usually use rsync -avHXS --numeric-ids --progress --delete

path: 0 25303355 25303980 25306987, hotness: undefined, score: 3, children: 0
GaumBeist 7 points 5 days ago

Clonezilla Live USB ftw

path: 0 25306224, hotness: undefined, score: 7, children: 0
curbstickle 5 points 5 days ago

Anything important is already stored elsewhere, so I just install clean.

path: 0 25304769, hotness: undefined, score: 5, children: 1
im_fine_sandy 3 points 5 days ago

Pretty much this... although I usually have at least a few moments of paranoia thinking about what I might be about to lose.

path: 0 25304769 25307493, hotness: undefined, score: 3, children: 0
fozid 3 points 5 days ago

Honestly dd is perfect. Like you say, shrink the partition down first, DD to the new disc, swap discs. That's it.

path: 0 25306079, hotness: undefined, score: 3, children: 1
MonkderVierte 2 points 5 days ago path: 0 25306079 25306757, hotness: undefined, score: 2, children: 0
daggermoon 3 points 5 days ago

Reinstalling because I use ZFS.

path: 0 25305867, hotness: undefined, score: 3, children: 0
hendrik 2 points 5 days ago

I always use dd or ddrescue. Takes 20min to open the computer, connect the drives, boot from usb, copy everything and you'd be done. Also super easy. Just pay a lot of attention before hitting enter. One small mistake and you copy it the wrong way around. Or overwrite your old drive in some other way.

path: 0 25307733, hotness: undefined, score: 2, children: 0
MonkderVierte 2 points 5 days ago

Adjust partition size if neccessary, then cp /dev/sda /dev/sdb.

path: 0 25306752, hotness: undefined, score: 2, children: 0
dan 2 points 5 days ago

I usually use Clonezilla and have it verify the data after cloning. It works for local drives, but it can also clone a drive over the network by running it on both the source and destination system, which is very useful for remote servers (eg moving a VPS to a different location).

path: 0 25306999, hotness: undefined, score: 2, children: 0
solrize 1 point 5 days ago

rsync

path: 0 25304895, hotness: undefined, score: 1, children: 0
db2 1 point 5 days ago

Out of curiosity, what are you doing that the difference between the two is woth that effort? Or is the pcie3 drive bottom of the barrel maybe?

path: 0 25304825, hotness: undefined, score: 1, children: 1
DampSquid 2 points 5 days ago

Yeah, exactly the latter. I noticed the other day that the thin copper layer that sits across the top of this drive had just popped off!

path: 0 25304825 25305373, hotness: undefined, score: 2, children: 0
MangoPenguin 1 point 4 days ago

I use a decent cloning tool like foxclone, dd isn't really the right tool for that kind of thing IMO.

path: 0 25319298, hotness: undefined, score: 1, children: 0
TerraRoot 1 point 5 days ago

Gparted works great as well, just umount drive and copy

path: 0 25306115, hotness: undefined, score: 1, children: 0
monovergent 1 point 5 days ago

Same thing you suggested, plus a btrfs scrub to check integrity when finished. I suspect btrfs provides a more elegant mechanism for this, which I have been too lazy to look up.

I could never reinstall ... I end up customizing so extensively that a few years ago, I centralized all of my customizations in a VM image that I clone if I do need a fresh install.

path: 0 25308395, hotness: undefined, score: 1, children: 0
SteveTech 1 point 5 days ago

Personally, when I get a new SSD I:

  • Format as 4Kn (for 'Better' or 'Best' performance)
  • Reinstall my preferred distro with a seperate home subvolume/partition (and tmp, var, etc. often with nodev,nosuid,noexec set)
  • Copy my /home across, and parts of /etc.
path: 0 25309200, hotness: undefined, score: 1, children: 0
BCsven 1 point 5 days ago

There's a way to do it without shrinking the partition and dd until last used block.

I use this to copy my Linux setup for a nas down to a 4 gig ISO for redeploy.

Have to check my notes...

Edit: Checked Notes

#Use-case of fdisk taking the approach that fdisk is used, and assumption is your "sudo fdisk -l " produced:

Disk /dev/sda: 64.0 GB, 64023257088 bytes
255 heads, 63 sectors/track, 7783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000e4b5
Device Boot Start End Blocks Id System
/dev/sda1 * 1 27 209920 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 27 525 4000768 5 Extended
Partition 2 does not end on cylinder boundary.
/dev/sda5 27 353 2621440 83 Linux
/dev/sda6 353 405 416768 83 Linux
/dev/sda7 405 490 675840 83 Linux
/dev/sda8 490 525 282624 83 Linux

The two things you should take note of are

  1. the unit size, and
  2. the "End" column.

In this case you have cylinders that are equal to 8225280 Bytes. In the "End" column sda8 terminates at 525 (which is 525[units] * 16065 * 512 = ~4.3GB)

dd can do a lot of things, such as starting after an offset, or stopping after a specific number of blocks. We will do the latter using the count option in dd. The command would appear as follows:

sudo dd if=/dev/sda of=/your_directory/image_name.iso bs=8225280 count=526

Where -bs is the block size (it is easiest to use the unit that fdisk uses, but any unit will do so long as the count option is declared in these units), and count is the number of units we want to copy Note that we increment the count by 1 to capture the last block).

Note to display units in cylinders: fdisk -l -u=cylinders /dev/sda Note for newbies of dd that of= can be a device you write to i.e. /dev/sdc, rather than a path to an iso image.

path: 0 25309763, hotness: undefined, score: 1, children: 0
eldavi 1 point 5 days ago

this is why i use lvm's.

i add the new drive to the lvm and afterwards remove the old drive from the lvm.

path: 0 25313599, hotness: undefined, score: 1, children: 0
linux
linux

@lemmy.ml

login for more options
67083
9205
4151

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

go to feed...