On Mon, Jun 6, 2016 at 7:24 AM David Christensen <dpchr...@holgerdanske.com>
wrote:

> On 06/05/2016 04:40 AM, Mark Fletcher wrote:
>
>
> > ... Any clever ploys to deal with [changing UID's and GID's after a
> > fresh install]?
>
> For users, I track usernames, UID's, and GID's, and refer to that when
> creating accounts.
>
>
> For services, I restore and chown -R if needed (I don't run many
> services, and the Debian project seems to have kept service UID's/GID's
> fairly stable over the years).
>
>
> David
>
>
>
In the end I successfully completed this. I removed the 1TB hard disk which
I had already migrated, moved the replacement SSD to where it had been, and
plugged in the other SSD which was to replace the 500GB main hard disk.
Booted as normal, and the trick was to mount the hard disk
(/dev/sda1,sd5,sda6,sda8 and sda9 ) to separate places on the filesystem.

So I created mount points under mnt for newroot, newhome, oldroot, oldusr,
oldvar, oldhome, mounted the partitions of the hard disk in those mounts,
(in addition to where they were mounted as part of the boot process, eg /,
/tmp, /usr etc) and the partitions of the new SSD (which I first had to
make) in newroot and newhome. Then it was fairly simple cp -a jobs to copy
everything over from there. Doing it that way, I copied what was on the
disk surface but didn't inadvertently grab anything that was actually in a
virtual file system.

I tried to be clever and use GPT partitions on the first SSD, thus proving
I wasn't in fact clever when I tried to install grub and found I needed to
have a "BIOS boot partition" (whatever that is) and didn't. So rather than
eff around unnecessarily with getting MBR boot to work on a GPT partition I
used parted to wipe the label and go back to a "msdos" partition scheme,
recreated the partitions and the file systems, and copied everything a
second time.

Then, install grub to the SSD using grub-install
--boot-directory=/mnt/newroot/boot /dev/sdc and then a grub-mkconfig -o
/mnt/newroot/boot/grub/grub.cfg.

Then reboot, and tell the BIOS setup to boot from the SSD first not the
hard disk. That fired up grub and I was able to select the SSD-installed
Linux. That booted successfully and that's what I'm using to write this.

Because I worked that way I had no file ownership problems, but I did
notice messed up permissions on the directories under / that had previously
been mount points, eg /usr, /tmp etc. Although /var was OK. For example
/usr was world writable which VirtualBox was none too impressed with.
Easily fixed, but I don't know why it happened.

Just one thing I wasn't sure about -- what should the permissions of the
/media directory be?

Apart from fixing that, what's left to do is to disconnect and remove the
500GB hard disk, move the SSD to the hard disk's SATA port so it is
/dev/sda, modify grub.cfg to reflect the move and to remove the hard-disk
boot menu items which grub-mkconfig, trying to be helpful, generated.

But I'm basically there apart from my question above about the permissions
of /media.

Thanks all for the advice -- was very helpful.

Mark

Reply via email to