Getting new hardware - can I just move the disk?

Liam Proven lproven at gmail.com
Wed Oct 13 10:58:00 UTC 2021


On Wed, 13 Oct 2021 at 11:15, Bo Berglund <bo.berglund at gmail.com> wrote:
>
> Turns out that the shrink *is* needed so I used up another almost 2 hours to
> shrink the source partition doiwn so it now has "only" about 35GB free space.

Yes.

> That is what I did in the end. And it worked even if it took the extra shrink
> time.

Good!

> So both the source and the target disks had to be edited to shrink the
> partitions involved in order to free up space on the target and to reduce the
> size of the copied partition on the source.

Sounds correct.

> Once that was done I copied the source partition to the destination disk in the
> free space created there.

Good.

> At this time the Paste option *was* enabled in the menu, so it is clear that
> GParted checks for a valid paste destination before offering it....

Yes.

> The source has these partitions:
> Partition   system  Size        Used        Unused      flags
> ---------------------------------------------------------------
> /dev/sda1    ext4   200.00 GiB  165.90 GiB  298.11 GiB  boot
> unallocated  ---    264.01 GiB
> /dev/sda2   extend    1.75 GiB       --       --
> /dev/sda5   swap      1.75 GiB   89.98 MiB    1.71 GiB
> unallocated           1.02 MiB
>
>
> The destination now looks like this:
> /dev/sdb1   ext4    224.61 GiB  221.13 GiB    3.84 GiB  boot
> /dev/sdb2   ext4    200.00 GiB  165.38 GiB   34.62 GiB
> unallocated          41.15 GiB

Top tip:  use the "name partition" and "label partition" options in
Gparted. Use them a *lot*, use them *all the time*.

"Label" (as far as I can tell) is the filesystem's internal name: what
the OS inside that partition sees as the name of the volume. Not all
disk formats support labels, and labels may be restricted to filename
limits on that filesystem. E.g. a FAT16 filesystem can only have
filenames of 8 letters, dot, 3 letters: say "READ_ME.TXT". FAT16
volume labels have the same restrictions but the dot is hidden:

"FAT_2_16GIB" is legal  (11 chars, 8+3) but "WINDOWS_4_SYSTEM" is not.

Windows uses and shows volume labels freely.

Unix has one big filesystem and no drive letters so there's nowhere to
show labels. They appear during boot and shutdown sometimes though.

Partition _names_ are in the disk partition map (I think!) and may
*not* be visible to the OS.

Use both. Give all your partitions descriptive names that are
meaningful. It's non-destructive and won't stop anything working. OSes
will boot just the same.

It is just for you, the human operating the system, but it makes it
*much* easier to keep track of what you copied where.


> It took another 1-2 hours overnight to copy the partition, but now I have a
> "real" backup!

Great!

> Notice that my final plan is to either move my whole /home to the free space on
> the source or else create a data partition for videos, which is the bulk of what
> I am storing in home, and leave /home itself in place (but much reduced in
> size).


A videos partition will be much easier. Maybe less clean and elegant,
but easier.

> To do this I need to:
> 1) Create a new ext4 data partition from scratch on the source disk.
> 2) Mount it in a suitable location and then rsync the video library over
> 3) Remove the video library from the source partition
> 4) Shrink the system partition correspondingly, will take a while, I guess..
> 5) Expand the data partition into the new free space to the left of it.
> 6) Configure fstab to mount the video data partition in the place it was
> originally located below $HOME
> 7) Hope for the best...

Yup.

Useful tool: /etc/mtab -- it's like /etc/fstab but it shows what's
mounted live, now. You can copy lines from it to /etc/fstab to make
them permanent.

> At this point the system partition will hold perhaps 36 GiB files and maybe some
> 25 GiB free space, whereas the remaining space is available for the video store.

> But it involves a number of time consuming operations...
>
> I guess I can do step 1) without involving GParted, i.e directly on the server
> command line, but which command should be used?

If you're not sure, then use Gparted. This operation is quick -- tens
of seconds.

> Steps 2-3 are obviously simple command line work.

Yes.

> Step 4-5 seems to require again booting from the DVD to get to GParted.

Yes.

> Command line would save me from bringing down the system for a period of time...

For making the partition, a few minutes will be enough.


-- 
Liam Proven ~ Profile: https://about.me/liamproven
Email: lproven at cix.co.uk ~ gMail/gTalk/FB: lproven at gmail.com
Twitter/LinkedIn: lproven ~ Skype: liamproven
UK: (+44) 7939-087884 ~ Czech [+ WhatsApp/Telegram/Signal]: (+420) 702-829-053




More information about the ubuntu-users mailing list