Getting new hardware - can I just move the disk?
Bo Berglund
bo.berglund at gmail.com
Wed Oct 13 09:13:04 UTC 2021
On Tue, 12 Oct 2021 23:17:11 +0200, Bo Berglund <bo.berglund at gmail.com> wrote:
>So I have freed up space on the target drive to hold the *data* in the source
>partition, which spans 464GiB, almost the whole disk, but uses only 165.9 GiB of
>data.
>
>Do I need to shrink the source partition before copying or is GParted clever
>enough to handle the size difference when pasting into the target's free space?
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.
>
>I have never copied partitions before, so I am a bit lost here.
>
>Two ways:
>
>1) Shrink the source partition to below 241.15 GiB (the free space on the target
>drive), then copy-paste.
That is what I did in the end. And it worked even if it took the extra shrink
time.
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.
Once that was done I copied the source partition to the destination disk in the
free space created there.
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....
>2) Copy-paste without shrink but let GParted figure out what size is needed on
>the new partition to hold the data.
This is not working!
But now I have this:
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
/dev/sdb2 is the backup clone of the Ubuntu system partition on my server
It took another 1-2 hours overnight to copy the partition, but now I have a
"real" backup!
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).
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...
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?
Steps 2-3 are obviously simple command line work.
Step 4-5 seems to require again booting from the DVD to get to GParted.
I am confused by what I find on-line since there are so many variations of
parted arguments used. Especially those involving location of the partition.
I just have to create the partition and format it ext4. No data to move at this
time.
Command line would save me from bringing down the system for a period of time...
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list