Re: [Dorset] Loss of OS during upgrade
Hi Clive, > ...as the laptop has 4 partitions: > sda1=OS (Mint) system files > sda2=swop > sda3=Home > sda4=odds area ... > From a 'live disk' would like to copy sda3 to another disk (USB 160Gb > with 2 partitions - sdb1=NTFS and sdb2= Ext4 140Gb) /dev/sda3 was about 286G big, with 102 GiB used, so the contents should fit in that 140 Gb USB. > How can I copy sda3 to sdb2 using a 'live disk' conserving all > properties. I don't know of a GUI program so command-line it is! Before we start, it's worth making sure the USB drive is plugged into the fastest USB port, if you have more than one and they're different speeds. This is normally coloured blue. The live disk might have automatically mounted the sda3 and sdb2 devices. To ensure they're not mounted run sudo umount /dev/sda3 /dev/sdb2 Now we're going to mount them where we want them to appear. Make a temporary directory to work in, and change the working directory to it. mkdir /tmp/disk-copy cd/tmp/disk-copy Make two directories, one for each of the filesystems we want to mount. mkdir source destination Mount the filesystems onto those directories. Make sure you get them the right way around! sudo mount -o ro /dev/sda3 source sudo mount /dev/sdb2 destination A peek inside should show recognisable contents. ls source destination Now copy the contents of the source directory into the destination directory. The trailing slash on each of those directory names is vital. (This is the rsync(1) program which Andrew mentioned.) sudo env RSYNC_ICONV=- rsync -PacivHAXxSsy source/ destination/ This will take a long time. It will print how it's going which may slow things down a little more, but the USB will probably be the bottleneck and I'm assuming you'd like the reassurrance it's doing something. That's assuming you want source/clive copied to destination/clive. If you want it in a subdirectory on destination then ensure it exists and alter the rsync command's destination argument. mkdir destination/home-2020-09-05 sudo env RSYNC_ICONV=- rsync -PacivHAXxSsy source/ destination/home-2020-09-05/ Again, note the trailing slash! Now, when the rsync finishes a copy should exist. But USB disk interfaces can be contrary so I recommend double-checking by unmounting the destination so Linux forgets all about its contents. sudo umount destination Unplugging the USB drive, presumably cutting its power supply. Plugging it back in again, then mounting it, sudo mount /dev/sdb2 destination and then running the exact same copy command, whatever you ended up with, a second time. Note, the cursor up and down keys move through your recent history of shell commands to save typing it all again. sudo env RSYNC_ICONV=- rsync -PacivHAXxSsy source/ destination/ It won't take so long this time because reading is quicker than writing and it will see the destination already has each file which it will read all the way through generating a checksum as it goes which it then compares to the source file's checksum. The checksums should match if it's a good copy so it won't print anything for this file and move onto the next. If the checksums differ then it will print a line as it updates the copy. So after a long time of hopefully not printing anything, as that shows the first copy was good, it will finish with a couple of summary lines. You can then unmount both devices. sudo umount source destination Haven't tried any of that so if it deviates from what you expect then probably best to halt and ask the list. You may want to save bits of text from the live disk. A ‘pastebin’ is handy. https://pastebin.centos.org/ is one example. Just paste your text into the big box on the form, and bump the ‘Delete After’ up to ‘1 Day’ so you've time to make use of it. On submitting the form it gives you a URL like https://paste.centos.org/view/6de8067c which can be noted down and re-entered on a different system to retrieve the text. You could paste the text of this email into it so you can copy-and-paste out of the pastebin when booted from the live disk to replace the chance of typos with pasteoes. :-) -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2020-10-06 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Laptop running fsck at every start
Hi Tim, > > > The only thing I see that mentions fsck and my partitions is below > > > but no mention of sda1: > > > > > > systemd-fsck[745]: /dev/sda2: clean, 254588/5185536 files, > > > 7727002/20719616 blocks > > > systemd[1]: Finished File System Check on > > > /dev/disk/by-uuid/75b45da2-86b3-4574-96d8-3de84f1c4c49. > > > systemd[1]: Mounting /home... > > > kernel: EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: > > > (null) > > > systemd[1]: Mounted /home. > > > systemd-fsck[682]: /dev/sdb1: clean, 609505/61054976 files, > > > 11916348/244190208 blocks > > > systemd[1]: Finished File System Check on > > > /dev/disk/by-uuid/04d578e3-78a4-474a-bac5-d048e001f565. ... > I ran a fsck on the ext USB hard disk and it was a mess, error upon > error. It was only at the start of August that I formatted the drive > and ran smart on it and it reported as alright no issues found. SMART is checking the veracity of the drive's media whereas fsck(8) can suffer from those problems but also spot errors in the filesystem's data which is reliably retrieved from the media. > Strange thing was when I booted the laptop up after removing the entry > in my fstab file it booted up without the File Check in progress > message. ... > For reference sdb1 was a 2.5" spinney disk?? ... > Fitted a new ext USB SDD drive and everything seems to be OK I expect it's still happening but removing the last spinning rust means it's all much quicker and so you either don't see it or, more likely, it doesn't reach the threshold in time which makes it get displayed. > So why was the file check saying that sda2 was clean It was. :-) > when obviously it was sdb1 that had the issues, there nothing in any > of the logs to suggest there was anything untoward with sdb1. Because a full filesystem check isn't being done at boot. systemd-fsck@.service(8) extracts: These services are started at boot if passno in /etc/fstab for the file system is set to a value greater than zero. systemd-fsck does not know any details about specific filesystems, and simply executes file system checkers specific to each filesystem type (/sbin/fsck.*). These checkers will decide if the filesystem should actually be checked based on the time since last check, number of mounts, unclean unmount, etc. systemd-fsck understands these kernel command line parameters: fsck.mode= One of "auto", "force", "skip". Controls the mode of operation. The default is "auto", and ensures that file system checks are done when the file system checker deems them necessary. "force" unconditionally results in full file system checks. "skip" skips any file system checks. So it starts fsck.ext4(8), probably with fsck.mode=auto. For ext3 and ext4 filesystems that use a journal, if the system has been shut down uncleanly without any errors, normally, after replaying the committed transactions in the journal, the file system should be marked as clean. Hence, for filesystems that use journalling, e2fsck will normally replay the journal and exit, unless its superblock indicates that further checking is required. -f Force checking even if the file system seems clean. It's worth performing forced fscks on filesystems periodically before media errors compound any filesystem-metadata problem. -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2020-10-06 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk