0

I am running a linux server off a bootable usb thumb drive. I have backed up the contents of the usb thumb drive with rysnc.

I have tried to test this backup by using a different usb thumb drive and creating the same partition layout as the current usb thumb drive. Such as the following:

drive: 60 GB USB thumb drive sdb1: 55.9G ext4 sdb2: 1k sdb3: 3.7G swap

I have copied over the contents to sdb1 using rysnc.

My question is, how do I now make this bootable so I can plug this into the same computer as the original USB drive and boot up as if nothing has happened to the original USB drive?

I imagine I would have to edit fstab to make sure the UUID is correct to the new USB thumb drive correct? I also assume I have to edit any grub.cfg file to also update the UUID, is that correct as well? Is there anything else that I might need to consider changing?

Thank you for any help.

Here is some of the info requested by Kamil:

Disk /dev/sdb: 59.6 GiB, 64019759104 bytes, 125038592 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: dos
Disk identifier: 0x8af780e1

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sdb1  *         2048 117260287 117258240 55.9G 83 Linux
/dev/sdb2       117262334 125036543   7774210  3.7G  5 Extended
/dev/sdb5       117262336 125036543   7774208  3.7G 82 Linux swap / Solaris

GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/sdb: 125038592 sectors, 59.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 6BF9EF56-C618-4F70-BC7E-920C50FB7A75
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 125038558
Partitions will be aligned on 2048-sector boundaries
Total free space is 6077 sectors (3.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048       117260287   55.9 GiB    8300  Linux filesystem
   5       117262336       125036543   3.7 GiB     8200  Linux swap

/dev/sdb1 on /var/folder2ram/var/log type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/log type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/tmp type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/tmp type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/lib/openmediavault/rrd type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/lib/openmediavault/rrd type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/spool type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/spool type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/lib/rrdcached type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/lib/rrdcached type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/lib/monit type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/lib/monit type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/lib/php type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/lib/php type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/lib/netatalk/CNID type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/lib/netatalk/CNID type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /var/folder2ram/var/cache/samba type ext4 (rw,noatime,nodiratime,errors=remount-ro)
folder2ram on /var/cache/samba type tmpfs (rw,nosuid,nodev,noexec,relatime)

sdb         8:48   1 59.6G  0 disk
├─sdb1      8:49   1 55.9G  0 part   /
├─sdb2      8:50   1    1K  0 part
└─sdb5      8:53   1  3.7G  0 part
  • In general some stage(s) of bootloader can exist aside partitions, rsync is not a right tool to deal with this. How did you create the bootable USB? Please show us the exact partitioning of the original drive: the output of fdisk -l /dev/sdb, gdisk -l /dev/sdb, file -s /dev/sdb. In addition the output of lsblk and mount from within the booted OS will be useful. Do not respond in comments, edit the question instead. There are tools to clone (or semi-clone) the entire device, including bootloader. You may not be able to do this right from within the OS started from the device. – Kamil Maciorowski Jul 29 at 5:34
0

You have to backup the OS installed to USB Thumbdrive with dd command to a file. Thus make reusable image of that drive. Than you can write that image file to another same sized or bigger USB Thumbdrive again with dd command. If you chose the bigger USB Thumbdrive, and you want to use full space of that drive, you have to resize partition after restoration.

You have to learn how to use dd command. For this you can use man dd command in Linux terminal. Or you can check google, there is a plenty examples out there.

  • Why do I have to do it that way? Couldn't I create a new bootable usb drive and copy over the contents and then boot up? – Avanst Jul 30 at 1:47
  • Yes you can do it but rsycn can't copy boot sectors. Also, I thought you want to copy entire USB to new thumb drive. If you just want to renew the OS inside of the current thumb drive, you can copy most necessary folders to a backup drive (/etc, /home etc.), then write new OS to thumb drive with proper software (unetbootin etc.), than restore the files back. There is big BUT. If you willing to change version of the OS, you have to reinstall all software from scratch. Because of the possible differences OS structure and changes in libraries might break the old software you intended to copy. – Sencer H. Jul 31 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.