Just did my first Linux clone disk job... surprisingly easy

mikeymikec

Lifer
May 19, 2011
18,570
11,223
136
Ever since I moved from my old Haswell setup to my new AMD 7000 PC, my trusty old Samsung 840 PRO SATA SSD has been hanging in mid-air in the new case. I had bought an NVMe drive to replace it with some weeks ago but I've been feeling a bit chicken about actually getting on with the work.

A quick google suggested using clonezilla which turned out to be a program that runs from a terminal but was surprisingly user-friendly, identifying each drive by connection to the system as well as the model of the drive (I was worried that my 1TB 980 PRO and this new 1TB 970 Evo Plus might be difficult to tell apart just by 'nvme' and identical capacity). It needed to be started from live CD/USB and was easily installed (sudo apt install clonezilla). The system booted fine straight away from the new drive, then I noticed that clonezilla had left ~700GB unpartitioned so I booted back to live USB, ran gparted, moved the swap partition to the end of the disk and then extended the ext4 partition to use the free space (all pretty point and click), applied the change, rebooted, all fine.

Any suggestions for how to run as complete a check as I can on a new storage drive with Linux? In Windows I typically do chkdsk /f /v /r on every disk I buy.
 

manly

Lifer
Jan 25, 2000
11,835
2,790
136
One thing I would carefully check is NAND block alignment. It's most likely OK, but when I repartitioned back in 2017, I think the tool got it wrong. I only fixed it last year.

Most distros will run fsck regularly, so I doubt you need to worry about it. You can run fsck on a running system but do NOT allow it to fix anything on a mounted filesystem. I believe you'd only need to run badblocks on spinning rust.

Clonezilla is great and perfectly suitable for AT forums members. For the mass public, I wouldn't call it user-friendly. Clonezilla live does not need explicit package installation? (As an aside, it will even shrink an NTFS partition, if you enable a particular experimental switch.)
 

mikeymikec

Lifer
May 19, 2011
18,570
11,223
136
One thing I would carefully check is NAND block alignment. It's most likely OK, but when I repartitioned back in 2017, I think the tool got it wrong. I only fixed it last year.

How would you go about checking it?
 

manly

Lifer
Jan 25, 2000
11,835
2,790
136
How would you go about checking it?


Does this post help? I did things the hard way, by using a calculator and making sure the starting sectors are aligned (has to be a multiple of 4096 bytes), because I was being anal retentive. Note that parted uses different units that makes the numbers look weird, by default.

And more:
 

mikeymikec

Lifer
May 19, 2011
18,570
11,223
136
Both SSDs are 512B/512B

4TB HDD is 512B/4096B

I ran align-check on the main ext4 partition and it says its aligned.

Re Windows - AFAIK on modern (SSD-aware such as Win7 and later) versions of Windows can be relied upon to get it right.
 

manly

Lifer
Jan 25, 2000
11,835
2,790
136
Clonezilla live was just updated:

Both SSDs are 512B/512B

4TB HDD is 512B/4096B

I ran align-check on the main ext4 partition and it says its aligned.

Re Windows - AFAIK on modern (SSD-aware such as Win7 and later) versions of Windows can be relied upon to get it right.
Did you check the C: partition and the swap partition as well?
 

ssokolow

Member
Jun 15, 2024
27
10
51
ssokolow.com
Any suggestions for how to run as complete a check as I can on a new storage drive with Linux? In Windows I typically do chkdsk /f /v /r on every disk I buy.
Since I mostly add new drives to an existing machine and reinstall boot drives from scratch (with the help of Ansible), the main thing I usually do is just ask the drive firmware to perform a thorough self-test before I format it (That'd serve the role of your /r switch) and then, if I'm moving data over, use something like a properly-optioned rsync to copy the files and then verify the contents are the same.

Among other things, this will reveal any sectors that are bad at the hardware level and should prompt it to relocate any weak sectors and can be done at any time without having to take the drive offline. It'll just take a little longer if you're using the drive while it checks in the background.
  • SATA: sudo smartctl -t long /dev/sdX and then use sudo smartctl -a /dev/sdX to view status
  • NVMe: nvme device-self-test /dev/nvmeN -s 2h and then use sudo nvme self-test-log /dev/nvmeN to check status
(smartctl is usually part of a package named smartmontools if it's not already installed and nvme is usually part of nvme-cli. In fact, smartmontools includes stuff you can set up to automatically run a self-test every N time interval and e-mail you about any failures if you set up local mail handling.)

However, if you want to also check a filesystem for consistency, the most convenient approach depends on a few details.

If the filesystem is ZFS, you can ask it to do a full self-check (including repairing corrupted data if it's in a mirrored or parity-enhanced configuration) without taking the system down by running zpool check to identify the pool name and then zpool scrub POOLNAME to start a scrub.

I haven't used btrfs, but Archwiki says it has a similar command for online checking and repair.

For other filesystems, the direct equivalent to chkdsk is fsck (which is actually a frontend for various filesystem-specific checkers like fsck.ext4) but it has to be run with the drive unmounted and how to force a check on boot is in a bit of flux right now so I usually just recommend that...
  • If you haven't booted off it, you can umount /whatever the partition and then use the fsck command. What options are available for things like automatic repair of inconsistencies depend on what filesystem-specific backend fsck hands off to. For example, ext4 supports fsck -p /dev/WHATEVER to "preen". (i.e. perform any repairs with only one, unambiguous, correct solution.)
  • If you have booted off it, I usually just reboot off a Linux LiveUSB stick so I can do some web browsing or something while it checks the usual boot drive and then follow the instructions for a drive I haven't booted off of.
 

pcgeek11

Lifer
Jun 12, 2005
21,621
4,676
136
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |