2

Because I have an ssd and an magnetic hard disk drive I have installed my GNU/Linux distribution like that:

  • The /var and /home in the magnetic one disk whilst
  • The rest of my system in ssd (the /)

But due to a mistake I allocated a small space for the /var therefore I want to reallocate it into a bigger partition in my magnetic disk.

But before I do that, I want to keep a temporary backup of the possibly affected partitions in an external hard disk drive or into a usb flash drive having either FAT or NTFS filesystems.

Therefore, if I mess up by the partitions to be able to recover. But how I can do that, how I can backup my partitions and in case of messing up how I can recover from it?

My magnetic disk is the /dev/sdb:

$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 465,8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000332e6

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sdb1  *        2048  15624191  15622144   7,5G 82 Linux swap / Solaris
/dev/sdb2       15626238 976771071 961144834 458,3G  5 Extended
/dev/sdb5       15626240  54685695  39059456  18,6G 83 Linux
/dev/sdb6       54687744 976771071 922083328 439,7G 83 Linux

Partition 2 does not start on physical sector boundary.

Whilst the ssd one is /dev/sda:

$ sudo fdisk -l /dev/sda
Disk /dev/sda: 111,8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: AB7DBE79-5651-4BC1-AD83-A890CDE1389F

Device         Start       End   Sectors  Size Type
/dev/sda1       2048 126001151 125999104 60,1G Linux filesystem
/dev/sda3  126001152 234440703 108439552 51,7G Linux filesystem

The partition I want to reallocate is the /var. Also as you can see the /var has little room left, and I assume that docker needs lots of it:

$ sudo df -h /var
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb5        19G   17G  964M  95% /var

The new /var will be into a new 100G partition allocated in /dev/sdb2. (I assume docker used for image building will take lots of space into /var.)

ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
Dimitrios Desyllas
  • 979
  • 3
  • 11
  • 27
  • 1
    If you plan to use docker you may separate it from the /var partition and have a standalone /var/lib/docker – francois P Jun 29 '19 at 14:24
  • 1
    As francois says, you can make the mount deeper. What I do though is make a big software raid-1 volume and mount it at `/storage` and then symlink things in - eg for my user's virtualbox machines I have `/storage/home/me/VirtualBox VMs` and I link `~/VirtualBox VMs` to that. Path on `/storage` duplicates path from root basically so I know what is pointing to where. – ivanivan Jun 29 '19 at 15:05
  • These type of answers are required in: https://unix.stackexchange.com/q/527647/173648 I strongly advise to set an appropriate answer based upon your comments in the question above. In this way more people will be benefitted from it. – Dimitrios Desyllas Jun 29 '19 at 15:25

0 Answers0