LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 02-23-2008, 04:46 AM   #1
Pandarsson
LQ Newbie
 
Registered: May 2004
Location: Houston, TX, USA
Distribution: openSUSE
Posts: 12

Rep: Reputation: 5
tricky backup of Linux system to NTFS partition to increase partition size


Hi. I recently installed Kubuntu on my laptop, giving it a 10 gigabyte partition by shrinking my Windows XP partition with a gparted live CD. I realize now that my estimate for the amount of space I'd need is woefully insufficient, so I'd like to give Kubuntu a 20 gigabyte parition. However, by now my system is highly customized with many added packages, updates and a few applications compiled from the source. There were some difficulties I managed to iron out along the way, as well. Considering all this, I don't consider a simple fresh install a good solution. Therefore, my plan is to back up what I have, reinstall, then restore the old system. This is where I need help and advice.

First is the tarring of the current system. Now, I mount my Windows partition to a 'Windows' directory in my home directory, so I want to exclude that. Tell me if I have the command correctly formatted. Let's say my user name is 'user'.

Quote:
sudo tar -jcvpf /home/user/Windows/currentsystem.tar.bz2 --exclude=/proc --exclude=/tmp --exclude=/media --exclude=/dev --exclude=/home/user/Windows /
If I understand it correctly, this means that my system will be backed up from the root directory to my Windows NTFS partition in a bzipped file called currentsystem.tar.bz2 but will exclude the Windows partition, /proc, /tmp, /media and /dev and will preserve permissions. Is this correct? If so, are there any other switches I should add? Am I excluding the correct directories? Are there any others I should exclude? There is only about 1.4 gigabytes of free space on my Kubuntu partition - will tar try to use this temporarily and run out of room or do all of its work in the Windows directory? Will tar still be able to keep the permissions despite the filesystem I'm telling it to save under?

Assuming all of this works, the next step is to actually resize the partition. Here's my plan:

Boot to Windows and defrag. Then boot using my gparted live CD and delete the old partition. Use gparted to shrink the NTFS partition, leaving 20 gigabytes of free space. Reboot to my Kubuntu live CD and install in the free space. Then untar my old system on top of the new one.

Sound solid? Foresee any problems? Am I missing anything?

Assuming all of that is correct and it works well, what switches should I use when untarring my old system? Better yet, if you could give me the full command, I'd deeply appreciate it.

Sorry for writing a novel here. I'd just like to get it all worked out in one so I'm ready for the operation.
 
Old 02-23-2008, 04:56 AM   #2
budword
Member
 
Registered: Apr 2003
Location: Wisconsin
Distribution: Switched to regualr Ubuntu, because I don't like KDE4, at all. Looks like vista on crack.....
Posts: 675

Rep: Reputation: 31
Your plan may work. I'm not sure. But other people have already written software that does exactly what you want, and given it to the rest of us via the GPL. Why not use it ? I would use partimage. There are other solutions, and yours may be a good one, I don't know. Here is a link, that goes over the use of partimage and knoppix, along with a few other possible solutions.

http://paulski.com/zpages.php?id=1912

Good luck...let us know how it goes...and which solution you decided on...

David

Last edited by budword; 02-23-2008 at 04:58 AM.
 
Old 02-23-2008, 06:03 AM   #3
Pandarsson
LQ Newbie
 
Registered: May 2004
Location: Houston, TX, USA
Distribution: openSUSE
Posts: 12

Original Poster
Rep: Reputation: 5
Thanks for the response. I looked at the link you gave and it's very interesting, but it doesn't answer many of my questions and concerns as it's aimed at the Windows user wanting to back up a Windows system. Still worth looking into and I thank you for the lead.

However, I like my step-by-step method, if it will work, and I'd like to find out the answers to my questions (if anyone has the time, patience and inclination) - both as a learning experience and because I'd be more comfortable doing it that way. I've studied some man pages and some answers to related, if not similar questions. Yet if there is any more experienced user who can verify things and give me a little nudge in the right direction, I would greatly appreciate it.
 
Old 02-23-2008, 10:32 AM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I rather doubt if the scheme would work unless Kubuntu is factory-fitted with ntfs-3g that can write on NTFS partition.

It also looks complicated as exclusions are specified and everything not specified will be archived and that does not seem to be what the OP wants.

I think the procedure can be a lot simpler if the Windows partition is cloned onto an external USB hard disk using dd. Say is internal partition is sda1 and the external partition is sdb1 then this command
Code:
dd if=/dev/sda1 of=/dev/sdb1 bs=32256
will create a mirror image on the external disk. The challenge is to make sdb1 exactly in size to sda1 in terms of the number of sectors. Generally I would prefer to clone the whole disk out as it is simpler but the process takes longer. The same command is used except input file and output file are just /dev/sda and dev/sdb.

dd copies only the binary bits of "1" and "0" of the whole partition of disk and any operating system can be copied. Besides it clones the boot sector too that file-copying commands cannot do.

Since hard disks are so cheap nowaday I tend to take the advantage to clone it to a bigger disk, swap the disk, make sure it boot normally and then resize the partitions in the new bigger disk.

Last edited by saikee; 02-23-2008 at 10:33 AM.
 
Old 02-25-2008, 02:15 AM   #5
Pandarsson
LQ Newbie
 
Registered: May 2004
Location: Houston, TX, USA
Distribution: openSUSE
Posts: 12

Original Poster
Rep: Reputation: 5
Quote:
Originally Posted by saikee View Post
I rather doubt if the scheme would work unless Kubuntu is factory-fitted with ntfs-3g that can write on NTFS partition.
It must. I leave my music collection on there and am not only able to access it, but I'm able to edit tags and save new songs to the 'My Music' directory on the NTFS partition. (I just deleted a few things from it as a test.)

Quote:
It also looks complicated as exclusions are specified and everything not specified will be archived and that does not seem to be what the OP wants.
Well, I either didn't get it across right or I don't understand here. As far as I can say, since I want not only the home directories of myself and one other person archived but everything installed and updated to this point, I'd like the whole system archived. The reason I excluded certain directories is because it seemed like, for instance, tarring /dev and untarring it over a fresh install's /dev would probably be a Bad Thing. Same with /proc. I'm not sure if I should include /media or not... but I can. /tmp just looks like it'd be a waste of space. Am I incorrect in this thinking?

Quote:
I think the procedure can be a lot simpler if the Windows partition is cloned onto an external USB hard disk using dd. Say is internal partition is sda1 and the external partition is sdb1 then this command
Code:
dd if=/dev/sda1 of=/dev/sdb1 bs=32256
will create a mirror image on the external disk. The challenge is to make sdb1 exactly in size to sda1 in terms of the number of sectors. Generally I would prefer to clone the whole disk out as it is simpler but the process takes longer. The same command is used except input file and output file are just /dev/sda and dev/sdb.
This is very interesting. I'm not sure why you're saying to clone the Windows partition instead of the Linux one. What would I do with that, then? I do want to leave Windows as the first partition for various reasons, but I want it shrunk and the Linux partition enlarged.

Other than that, I can see the ease of copying the entire disk to another so I can keep the old Linux system intact and copy it over once I've adjusted partition sizes, but despite the ease, isn't it a little overkill just to restore the Linux part of it? I guess this is all academic because I can't afford a new harddrive, let alone be picky about the number of sectors I get (especially since I'd be getting a harddrive for a laptop). Still, I'm curious.

Thanks for your reply.
 
Old 07-09-2008, 02:35 PM   #6
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.13.2
Posts: 1,466
Blog Entries: 10

Rep: Reputation: 141Reputation: 141
Your plan looks good, though of course, it may not work. The problem, as I see it, is that you will have only one try at this without a safety net. I would strongly suggest that you get an external HD and use it to make a backup. You should be backing up regardless and hard disks are incredibly cheap per megabyte these days.

In fact, if you did that you would also be able to avoid the uncertainty of writing a massive compressed file onto your windows partition with ntfs-3g, and the uncertainty of having a running bootable system with untarring. If you did use an external HD, I would use rsync to backup, see e.g.

http://www.sanitarium.net/golug/rsync_backups.html

With a bit of contriving, you might even be able to boot into the rsynced version on the harddisk..

Having said that:

With this kind of operation on your running hard disk, you want to be able to do a baremetal backup, easily. I can recommend Acronis TrueImage, you can run it from Windows or Linux or have it as a bootable rescue that can bare metal recover your system in minutes. Easily worth the money. Get the corporate version if you can.

Last edited by mostlyharmless; 07-09-2008 at 02:37 PM. Reason: typo
 
  


Reply

Tags
backup, gparted, ntfs, partition, resize, tar


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Increase Partition Size shane200_ Linux - Hardware 1 08-24-2006 12:06 PM
Increase the size of linux partition sandy Linux - General 3 10-18-2002 02:53 AM
Increase Partition Size RedHat 7.0 capam2k2 Linux - Software 3 10-05-2002 08:50 AM
Installing a second HD: How do I increase the size of a Linux partition? entm Linux - General 3 06-01-2002 02:10 PM
how to increase disk partition size richiet Linux - Software 6 01-29-2002 03:14 PM


All times are GMT -5. The time now is 03:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration