Copy system partition to same disk ? [SOLVED]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Copy system partition to same disk ? [SOLVED]

Postby ron_h on Mon Jun 16, 2014 1:12 am

LMDE 201403 Cinnamon 64bit

I would like to have on the only hard drive on my netbook

1. My normal LMDE system, including /home, in a partition that I can boot to from GRUB menu
2. A complete copy of my normal LMDE system, to use as LMDETEST for updates and other changes, in a second partition that I can boot from GRUB menu
3. A complete backup of my normal LMDE system in a third partition. I don't want to be able to boot this partition.

I'm happy for the partitions for 1 and 2 to be identical in size.

At any point in time I want to be able to create a new 3 based on the current 1.
At any point in time, I want to be able to restore 3 over either 1 or 2 if either becomes unusable, or indeed for any other reason.
I do not need, for this, any selective file backup or restore function.


What is the best way, and the best tools, to achieve this ?
I have available LMDE 201403, Live LMDE 201403 on USB stick, and Live Pmagic (aka PartedMagic) on USB stick (includes Gparted, Qt4-fsarchiver and Clonezilla and several other tools).

Ron

BTW, I've already discovered using Clonezilla to clone 1 to 2 is not a good idea as the GRUB menu to choose whether to boot 1 or 2 is not straightforward.
Last edited by ron_h on Sat Jun 21, 2014 2:15 am, edited 2 times in total.
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Linux Mint is funded by ads and donations.
 

Re: Copy system partition to same disk ?

Postby Pierre on Mon Jun 16, 2014 1:55 am

probably Gparted - the same tool that the installer used to partition the drive, when installing the O/S.

- use it's ability to copy / paste ( via mouse ) from /home to home_backup.
copy the other way to restore back to the original.

- you could do the same with the system ( / )

you would need two of each partition ( original & backup ),
where the backup would not get used by he system itself.

- it would pay to make each mirror partition, the same size as the original partition was.
maybe even keep the mirror copy on a different hdd.

you might come unstuck, if the grub boot_loader was ever updated,
& it detected the mirror copies & added them to the grub list as a real system. ..

so. maybe keep the mirror copies offline.
Image
User avatar
Pierre
Level 6
Level 6
 
Posts: 1230
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Copy system partition to same disk ?

Postby ron_h on Mon Jun 16, 2014 2:06 am

Does Gparted 'copy partition' make a clone ? That is, same UUID ? If so, and it's on the same disk, there are GRUB problems. The netbook only has one disk and I want to be able to boot 1 or 2 as noted above using just that one disk. As to why I want to do this, I watched one unfortunate on a tour I was on, when the OS on his netbook became unusable and he had no restore capability while on the 2 week tour. At home yes, but that was 10,000 miles away.

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby wayne128 on Mon Jun 16, 2014 3:04 am

ron_h wrote:Does Gparted 'copy partition' make a clone ? That is, same UUID ? If so, and it's on the same disk, there are GRUB problems.


Yes, gparted will create a perfect clone.
UUID, etc will be the same
You will have the same problem like clonezilla when you want to run BOTH original and cloned partition at the same time.
wayne128
Level 10
Level 10
 
Posts: 3279
Joined: Tue Jul 13, 2010 12:15 am

Re: Copy system partition to same disk ?

Postby wayne128 on Mon Jun 16, 2014 3:34 am

ron_h wrote:At any point in time I want to be able to create a new 3 based on the current 1.
At any point in time, I want to be able to restore 3 over either 1 or 2 if either becomes unusable, or indeed for any other reason.
I do not need, for this, any selective file backup or restore function.


What is the best way, and the best tools, to achieve this ?


I cannot say anything about whether which is the best way, best tools..
But then there are so many possible solutions, probably twice as many as the people going to response.

Here I just tell you how I did my multiboot in many computers.
My method is like this.

1. Partition the internal hard disk to have as many partition OS as you desire.
Says you wish three partitions, so you have three ext4 partitions for OS.
then you share a swap partition
for me, I always use data partition, I share with Win, so I go for NTFS format.
you can consider any linux format like ext 4, but for me, NTFS works well because I let everybody to have right to write and read for all partition OS, just to simply life and enjoy playing with so many linux os'es.

you could use FAT32 too, it is simple , however, the only limit is file size max at 4G.
if your clone or backup partition can exceed 4G then FAT32 is not a solution for you

2. my typical partitioning for your case , if it is msdos-partition hard disk, will then be
a. sda1, 20G size, ext4, for first OS
b. sda2, 20G size, ext4, for second OS
c. sda3, 20G size, ext4, for third OS
d. sda4, extended partition to hold all other space (logical partitions , swap and unallocated space)
e. sda5, a large NTFS formatted partition for data partition
f. sda6, a swap, typically about size of RAM for suspend/hibernation
g. optional, leave some 10-20G for play,, hmm, I always give some unallocated space for testing..


3. Then install the first OS to sda1

4. run with your usb's pmagic, run qt4-fsarchiver, follow tutorial, backup from sda1, and save to sda5, the data partition, named it anything you like, but to make you life easier later, it is usually for me to have a long name to denote what was I playing during the time before I backup, and added also some designation to denote the source...

something like
LMDEmate_on_sda1withfglrx141

LMDEcinnamonsda1nvidia333

5. now, for me to make the same sda1 partition OS to sda2,
run with usb's pmagic, run qt4-fsarchiver, follow tutorial, do a reverse of item4,
restore from the file taken from sda5, navigate to the directory containing the filename as in item4
and point the designation partition to sda2

it will take ,hmm, average 3-5 minutes for a small size OS partition like 10G size.

6. each time when I wish to back up, I repeat the steps in item4
each time when I wish to restore I just use steps in item5

7. one example, I am running sda1 now,
LMDEcinnamonsda1nvidia333

and I want to do full dist-upgrade with a change of repos to debian testing
I follow item 4 to save first to sda5
I had another safety net, I copy those sda5 backup files to external USB!!!
this is to take care of some weired time when a alpha, beta distros or even solid distros with some changes , at time unfortunately I may end up with a totally borked system, very rare time, the installer might even wipe out everything... you need such thing to happen once to realise... :mrgreen: :mrgreen:

now use item5, restore from sda5 LMDEcinnamonsda1nvidia333 , to sda3

play with it, change repos, dist-upgrade, etc
if works, use item 4 to save it to sda5, but change the filename to something like
LMDEcinnamonsda3nvidia333debiantesting


hope this explain what I usually do.
hope that helps ...ymmv :mrgreen:
Last edited by wayne128 on Mon Jun 16, 2014 8:45 am, edited 1 time in total.
wayne128
Level 10
Level 10
 
Posts: 3279
Joined: Tue Jul 13, 2010 12:15 am

Re: Copy system partition to same disk ?

Postby ron_h on Mon Jun 16, 2014 5:23 am

Many thanks. On reflection, I should have asked for good ways rather than best ways ...

You have given me plenty of food for thought.

UPDATE In your item 4, you say 'run with your usb's pmagic, follow tutorial ...'
The Live pmagic USB stick that I have, has several programs that can copy or clone a partition. Which program do you use ?

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby wayne128 on Mon Jun 16, 2014 8:44 am

ron_h wrote:
UPDATE In your item 4, you say 'run with your usb's pmagic, follow tutorial ...'
The Live pmagic USB stick that I have, has several programs that can copy or clone a partition. Which program do you use ?



qt4-fsarchiver

thanks for point it out :mrgreen:
I edit the previous post , add 'run qt4-fsarchiver'.
wayne128
Level 10
Level 10
 
Posts: 3279
Joined: Tue Jul 13, 2010 12:15 am

Re: Copy system partition to same disk ?

Postby ron_h on Mon Jun 16, 2014 9:53 pm

Thank you, I was beginning to think qt4-fsarchiver would be a good tool to do what I want to do

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby ron_h on Wed Jun 18, 2014 1:53 am

For item 5, the restore, once it is complete, need to make the partition able to be booted. Do you run update-grub ? Or use another method of creating a menuentry for GRUB ? Or what ?

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby wayne128 on Wed Jun 18, 2014 2:19 am

ron_h wrote:For item 5, the restore, once it is complete, need to make the partition able to be booted. Do you run update-grub ? Or use another method of creating a menuentry for GRUB ? Or what ?

Ron


No, I do not run update-grub, afterall I always use pmagic, running in LIVE mode to restore partition..update-grub does not make sense onto a live pmagic os.

Lets say I am restoring a linuxOS onto /dev/sda8

after restore, to make /dev/sda8 bootable as well as let it's grub took over mbr, I just mount it and install grub to mbr.


mount /dev/sda8 /mnt

grub-install --root-directory=/mnt /dev/sda
wayne128
Level 10
Level 10
 
Posts: 3279
Joined: Tue Jul 13, 2010 12:15 am

Re: Copy system partition to same disk ?

Postby ron_h on Wed Jun 18, 2014 3:34 am

And does this then give you a GRUB menu which allows any of the bootable OSs on the drive to be booted when you next power up ? The default OS to be booted would presumably be the one on sda8 in your example.

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby wayne128 on Wed Jun 18, 2014 3:51 am

ron_h wrote:And does this then give you a GRUB menu which allows any of the bootable OSs on the drive to be booted when you next power up ? The default OS to be booted would presumably be the one on sda8 in your example.

Ron


After mount /dev/sda8 and install grub to mbr, the next reboot will get grub conf by /dev/sda8.

Regarding whether would sda8 boot ANY other partitions..
the answer is depends on during backup of your sda8 , what OS in the other partitions which were bootable with the old grub.cfg
If those partition did not get altered, then yes, sda8's grub.cfg will boot those it could boot..


however, if after you backup sda8, you made several changes on partitions or repartition...
then of course you do not expect the 'restored sda8 with old grub.cfg' to boot those new partition OS, that did not exist during the last backup.... :lol:

but no worry, it is quite simple to update grub config,
just boot and run sda8, then sudo update-grub would renew for you a new config file.
wayne128
Level 10
Level 10
 
Posts: 3279
Joined: Tue Jul 13, 2010 12:15 am

Re: Copy system partition to same disk ?

Postby ron_h on Wed Jun 18, 2014 4:02 am

Thank you

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby ron_h on Thu Jun 19, 2014 2:34 am

4. run with your usb's pmagic, run qt4-fsarchiver, follow tutorial, backup from sda1, and save to sda5


1. I have booted with the pmagic USB stick (**), started qt4-fasarchiver, but I can't see how to 'follow tutorial'. How/where do I access the tutorial at this point ?

2. I can see how to select from 'Existing Partitions', so if I select one (I want to back up sda6) and then select 'Save partition' presumably it will be saved/backed up. However I don't see how/where to specify where it is to be saved to. The only other thing I can see is a box labelled 'Backup directory' but this does not include any partitions, only directories, which I assume are those on the USB.

I don't know if it makes any difference, but the partition I want to save to (sda9) was created by Gparted as an ext4 partition and has never been used since it was created. Nothing on it at all, as far as I know (*). Do I need to do anything to it to make this partition 'usable' ?

Ron

* UPDATE When I look at sda9 using the File Manager app oin the pmagic system, it shows a directory 'lost+found' (/media/sda9/lost+found) which itself contains nothing

** UPDATE I have PartedMagic 2013_08_01 version installed on the USB
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby wayne128 on Thu Jun 19, 2014 4:09 am

ron_h wrote:1. I have booted with the pmagic USB stick, started qt4-fasarchiver, but I can't see how to 'follow tutorial'. How/where do I access the tutorial at this point ?


When I mentioned follow tutorial, I meant to follow viking777's post

Partition Images with qt4-fsarchiver.
Postby viking777 » Sun Feb 03, 2013 10:01 pm



Read the post.viewtopic.php?f=90&t=170190#p874836

click on link
viewtopic.php?f=42&t=124636 to get into viking777's post.


take a while to learn how to navigate, but once you get it , it should be quite straight forward.


2. I can see how to select from 'Existing Partitions', so if I select one (I want to back up sda6) and then select 'Save partition' presumably it will be saved/backed up. However I don't see how/where to specify where it is to be saved to. The only other thing I can see is a box labelled 'Backup directory' but this does not include any partitions, only directories, which I assume are those on the USB.



refer to viking777's post,
the key steps, copy from his post, are
A= Existing partition ie. What do you want to image.
B = Backup Directory ie Where do you want to put it
C = Name of backup - you don't even need to put the date, it does that automatically.
And that is it, press Save Partition and wait.


You should have no trouble on step A and C


Now i explain a little on my step B
this is where I define a directory where the qt4's backup is going to store my file, filename defined in step C, say this file is named debianXfecSid_sda6

This is my example :

I usally save the backup file to the data partition of internal hard disk, for me I have data partition on /dev/sda5, in NTFS format.

So on my step B
I would just navigate to /dev/sda5 and within it I have a directory called fsarchiver
once I hightlight fsarchiver, I am done on this step B and can proceed to step C

On Step C, I would type in a filename, say I type debianXfecSid_sda6

Then I proceed to click Save partition, which is immediately below the C in viking's post.

and see that it is running,... take a while..

when finished, I would find my backup file in the directory
/dev/sda5/fsarchiver

and filename will be admended by qt4' to add subfix of date onto my original typing
something like
debianXfecSid_sda6-28-4-2014



I don't know if it makes any difference, but the partition I want to save to (sda9) was created by Gparted as an ext4 partition and has never been used since it was created. Nothing on it at all, as far as I know. Do I need to do anything to it to make this partition 'usable' ?



If you are following upto here you know I now have a sda6 backup as a compressed file with the filename
debianXfecSid_sda6-28-4-2014

Now, if I want to restore this
debianXfecSid_sda6-28-4-2014 to another partition sda9, what I would do is

Follow viking777's post
refer to his second image download/file.php?id=12659

boot and run from USB pmagic

run qt4-fsarchiver

click Restore partition with fsarchiver

on existing partition, click the partition I want to restore to, which is /dev/sda9

on name
navigate to the backup file , which is
/dev/sda5/fsarchiver/debianXfecSid_sda6-28-4-2014


click Partition restore

here, qt4's will flag with a statement, something like the partition you want to restore is different from the saved....(because I save from sda6 but trying to restore to sda9... normal process is restore to the previous saved partition sda6) ...
since I do it on purpose, so I would proceed to restore to sda9


and watch it runs for a few minutes..

when complete, since I choose to boot directly from sda9 on next reboot, to do that, while I am in pmagic, open a root terminal
Code: Select all
mount /dev/sda9
grub-install --root-directory= /mnt /dev/sda


then reboot and I should be running directly from sda9

to check that sda9 is running without the sda6 being mounted..
I would just use this command at root
Code: Select all
blkid -o list

and see that sda9 is mounted,,,, and sda6 is NOT mounted.

hope that helps.. :mrgreen:
wayne128
Level 10
Level 10
 
Posts: 3279
Joined: Tue Jul 13, 2010 12:15 am

Re: Copy system partition to same disk ?

Postby ron_h on Thu Jun 19, 2014 8:37 am

That helps a lot. I misunderstood the ref to the tutorial, I thought it was 'inline' at that point, rather than a step sideways. I've now looked at viking777's post as well as the previous in this thread and as a result I think I now understand how to select the output location whereas before I couldn't work out how to use the Backup Directory window.

I now have a backup running, I used /media/sda9/(directory) rather than /dev/sda9/(directory) as the destination. I assume there's no difference :-) between the two in what actually happens. I do find this terminology a bit strange after DOS, OS/2 and Windows where C:, D: etc are all you need to know. But, life is a learning experience.

Many thanks again.

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby wayne128 on Thu Jun 19, 2014 8:49 am

good to know it works for you

just one interest... can you just post the results, on root terminal

blkid -o list

and compare your old sda6's uuid and the sda9's uuid..

also check if sda6 is mounted when you are running sda9
wayne128
Level 10
Level 10
 
Posts: 3279
Joined: Tue Jul 13, 2010 12:15 am

Re: Copy system partition to same disk ?

Postby ron_h on Thu Jun 19, 2014 6:11 pm

Sorry, you posted that after I'd shut down, so I've only seen it this morning (Friday, Sydney time).

OK, I'll do that after the netbook boots up. At this time on the netbook sda6 is an LMDE system, sda8 is an LMDETEST system and sda9 is purely for backup and contains at the moment only the fsarchiver backup files from the only backup I've done so far. I do not intend to run sda9, it will be for backups only. What I will be doing later is restoring the backup from sda9 to sda8, to replace the LMDETEST system, but wasn't planning on doing that just yet, there's some more things I want to do with the current LMDETEST first.

Can I use

Code: Select all
sudo blkid -o list


or will that give a different result ?

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby ron_h on Thu Jun 19, 2014 6:19 pm

Code: Select all
sudo blkid -o list
[sudo] password for ron:
device     fs_type label    mount point    UUID
-------------------------------------------------------------------------------
/dev/sda1  ntfs    PQSERVICE (not mounted) 16BCF517BCF4F1DB
/dev/sda2  vfat             (not mounted)  E2F0-474B
/dev/sda3  ntfs    SYSTEM RESERVED (not mounted) 28BCF745BCF70BD6
/dev/sda5  ntfs    Acer     (not mounted)  B030F98030F94E3A
/dev/sda7  swap    SWAP     <swap>         afc6dcda-65ea-446d-9c95-4d355a03debc
/dev/sda6  ext4    LMDE     /              c456e7bd-e79e-496c-93a1-5c522359fdaa
/dev/sda8  ext4    LMDETEST (not mounted)  015fac40-f127-11e3-ad5a-2b2b889acdff
/dev/sda9  ext4    LMDE-Backups (not mounted) 66baa952-9b89-412e-be38-272d42cd9096


No problems with UUIDs, it seems.

Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: Copy system partition to same disk ?

Postby ron_h on Fri Jun 20, 2014 11:50 pm

I booted sda8, LMDETEST. I have just used qt4-fsarchiver, installed on sda8, to restore the backup I took of sda6 to another partition (sda10). Sadly, sda10 now has the same UUID as sda6. So it seems I can not use qt4-fsarchiver to back up a partition, then restore the backup to a different partition on the same hard drive, and expect to be able to generate a GRUB menu that will allow either the original partition or the restored partition to be booted. In order to do that, it seems, I'll first have to get a new UUID for the restored partition then go in and modify all and any files on the restored partition that contain the UUID, and at that point I should be able to generate a GRUB menu. Disappointing.

Code: Select all
sudo blkid -o list
[sudo] password for ron:
device     fs_type label    mount point    UUID
-------------------------------------------------------------------------------
/dev/sda1  ntfs    PQSERVICE /media/sda1   16BCF517BCF4F1DB
/dev/sda2  vfat             /media/sda2    E2F0-474B
/dev/sda3  ntfs    SYSTEM RESERVED /media/sda3 28BCF745BCF70BD6
/dev/sda5  ntfs    Acer     /media/sda5    B030F98030F94E3A
/dev/sda7  swap    SWAP     <swap>         afc6dcda-65ea-446d-9c95-4d355a03debc
/dev/sda6  ext4    LMDE     /media/sda6    c456e7bd-e79e-496c-93a1-5c522359fdaa
/dev/sda8  ext4    LMDETEST /              015fac40-f127-11e3-ad5a-2b2b889acdff
/dev/sda9  ext4    LMDE-Backups /media/sda9 66baa952-9b89-412e-be38-272d42cd9096
/dev/sda10 ext4    QT4TEST  (not mounted)  c456e7bd-e79e-496c-93a1-5c522359fdaa


Ron
ron_h
Level 3
Level 3
 
Posts: 178
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Linux Mint is funded by ads and donations.
 
Next

Return to Newbie Questions

Who is online

Users browsing this forum: No registered users and 3 guests