LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-13-2005, 04:33 AM   #1
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
dd vs. partimage vs. tar?


Please don't flame! I did a search about backup techniques but it seems like I have to mix pieces of them to achieve what I want and that's whay I'm posting this. My problem would be: when I installed Linux (as a total n00b), I did it on a 2nd, 10 GB HD like this: / on /dev/hdb1, /home on /dev/hdb6 and swap on /dev/hdb5.

df shows:
Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdb1             2.6G  1.6G  887M  65% /
tmpfs                 251M     0  251M   0% /dev/shm
/dev/hdb6             6.3G  883M  5.1G  15% /home
none                  5.0M  2.8M  2.3M  56% /dev
What I want is to enlarge hdb1 using space from hdb6. Therefore I want to backup first the current install (actually / ). I first thought to use partimage but it turned out that when restoring, the partition must be the same size. So, no use for partimage.
Then, on my first HD (120 GB), which holds XP(one partition), multimedia stuff, docs, etc. (2nd partition) I made with PMagic (from XP) a third partition (fat32, 6 GB) to backup hdb1. Then I did a dd if=/dev/hdb1 of=/dev/hda5 (under Knoppix, of course). Yet, a df shows the newly created and diskdumped hda5 to be exactly the size of hdb1 (2.6G) instead of 6G.
Then I read that you need to use resize2fs to set the things up.

The actual question(s) are:
1.how safe is it a resizing of hdb1 (and hdb6 accordingly) using qtparted from Knoppix?
2.if something goes wrong with the resizing (data loss on hdb1), is the following procedure right:
-dd if=/dev/hda5 of=/dev/hdb1
-e2fsck -f /dev/hdb1
-resize2fs -f /dev/hdb1
3.(probably this one should have come first): why qtparted (from Knoppix) isn't allowing me to resize (greyed out buttons) hdb's partitions (even if I 'swapoff /dev/hdb5')?
4.'fdisk -l /dev/hdb' says:
Code:
Disk /dev/hdb: 10.0 GB, 10005037056 bytes
16 heads, 63 sectors/track, 19386 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
 Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        5435     2739208+  83  Linux
/dev/hdb2            5436       19386     7031304    f  W95 Ext'd (LBA)
/dev/hdb5            5436        6119      344704+  82  Linux swap
/dev/hdb6            6120       19386     6686536+  83  Linux
what is doing out there a W95 extended partition when I formatted hdb only with Linux fsystems during Debian install?
5. would tar (or dar) be more suitable for what am I trying to do?

That's about it...unless I come upon something else.
Thanks to anyone who'll reply.

Last edited by harken; 02-13-2005 at 04:36 AM.
 
Old 02-13-2005, 05:16 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,567

Rep: Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499
Caveat; I have *NEVER* used any resizing tool. I'll buy a new disk in preference, and copy to that.
Rule no 1 -> infinity.
- you can never have too many backups.

If you only ever need to restore a "point-in-time" image, a block mode backup might be the way to go.
Partimage and dd fall into this classification.
In most cases not much use unless recovering back to the same disk (or same geometry).

I like tar, and since I found it, dar even better - although I have yet to try the latter.
Excellent solution though IMHO.

Don't worry about the extended partition - they always show up like that
 
Old 02-13-2005, 06:00 AM   #3
sys7em
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Slackware
Posts: 158

Rep: Reputation: 30
Why don't you try this backup script package:

http://themlg.net/~offroad/tmp/backupscripts.tar.gz

It has a README inside ... and you should be able to understand how it works ...

GL
 
Old 02-13-2005, 06:31 AM   #4
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Original Poster
Rep: Reputation: 30
Thanks for the link sys7em, but the archive doesn't contain any README file. Yet, I swepped over the shell script and it looks like it is designed to split data into 650 MB chunks and write them to a CD. Which is not what I am after.
Basically, I want to enlarge a partition using space from another one and I want to make sure I'm safe if something goes wrong.
Other suggestions?
 
Old 02-13-2005, 11:40 AM   #5
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Original Poster
Rep: Reputation: 30
Ok, let me put it another way: if, hypothetically, I want to wipe out the partition containing '/', an archive of it created with tar (dar) would allow me to restore it just as it was...and would it boot again like nothing happend? Even if I resize that partition?

Sorry for asking twice, but I thought I made my question a bit more "readable".
 
Old 02-13-2005, 02:04 PM   #6
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
What I want is to enlarge hdb1 using space from hdb6.
You cannot do this. Period.

hdb6 is the second extended partition on the extended partion defined by hdb2. It is not contiguous with hdb1 (does not share a boundary with it) and is of a different type (extended partition vs primary partition). You cannot take space from hdb6 and add it to hdb1.

The easiest thing for you to do would be to move your / to hdb6 and size it to suit yourself. You could make this change using dd then change your boot loader to deal with the new location.

If you insist on keeping hdb1 as your root partition, then you need to do the following, in order.

1. back up the contents of hdb6.
2. disable swap.
3. delete hdb2 (which will delete hdb5 and hdb6 as well).
4. resize hdb1 to suit yourself, then resize the file system on hdb1.
5. recreate hdb2 beginning at the end of hdb1 and filling the rest of the disk.
6. recreate your swap as hdb5.
7. reenable swap
8. recreate hdb6
9. reload hdb6 from backup.
 
Old 02-13-2005, 02:30 PM   #7
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Original Poster
Rep: Reputation: 30
Thanks, you made me open my eyes. It totally slipped my mind that hdb1 is primary while hdb6 is extended
Ok, I mainly get the idea but can you elaborate just a bit on points 4-6, 8?
In fact, if I got it right, the corresponding steps would be:
1.tar(dar) hdb6
2.swapoff /dev/hdb5
3.fdisk (or qtparted) ->delete hdb2
4.-6.qtparted (+ fdisk maybe?)
7.swapon hdb5
8.qtparted again
9.i'll figure it out

Please correct me where I'm wrong.

And something else: if I do it like you said, I shouldn't worry about data loss on hdb1 because its end section will be altered, not the section that holds the actual data, right?

Maybe you'd be so kind to recommend a adequate technique for point (1)?

Thank you very much!
 
Old 02-13-2005, 03:11 PM   #8
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
you could resize the partition using parted or using sfdisk (if you know exactly what you are doing). I think you will have to resize the partition working from an alternate linux and not within your existing linux environment. If you are fearless you could use, for instance, lde to manually change the endpoint information in the partition table while up and running in Linux but if you make a mistake you could be very sorry. FWIW, this is how I would do it (using lde and manually changing the partition table on the fly with it). I then would boot into an alternate linux installation in order to use resize2fs to change the size of the file system to match the partition.

You can create partitions with any number of tools, including parted, fdisk, cfdisk, sfdisk, any of the distro graphical tools for disk management, etc.

Actually, the easiest way to do all of this is to obtain a Knoppix CD and boot from that. There are graphical tools on Knoppix that will let you easily do the whole thing, including the delete and the nondestructive resize.
 
Old 02-14-2005, 02:19 AM   #9
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Original Poster
Rep: Reputation: 30
Actually I do have a Knoppix 3.7 CD and the steps I mentioned were intended to be executed from Knoppix.
So, this being the situation, would it be right to proceed as I said? Some hints, advices?
 
Old 02-14-2005, 07:20 AM   #10
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Original Poster
Rep: Reputation: 30
After reading some more Q&As on this topic here at LQ, I saw someone recommending the following procedure for resizing(enlarging) a partition: back it up with partimage, delete, recreate, (these 2 points with qtparted) restore the image then resize with resize2fs and everything should be ok.

Is it possible? In partimage's docs says that the partition on which the restoration will be made must be the same size as the old one.
So?
 
Old 02-14-2005, 07:37 AM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,567

Rep: Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499Reputation: 3499
So ???.
The resizing is post the restore. Apparently works for o.k. ext2 - *not* ext3 I believe.

I have to ask, why the hand-wringing and complexity ???.
Backup the data on a filesystem basis (tar, dar, cpio whatever the hell that does the job).
Delete the partitions, re-create them the required size, and restore the data.

What's so damned hard ???.

Sorry - it's late here, obviously time I went to bed.
 
Old 02-14-2005, 08:49 AM   #12
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Original Poster
Rep: Reputation: 30
Quote:
So ???.The resizing is post the restore.
This is what you said.
Quote:
restore the image then resize with resize2fs
This is what I said.
Quote:
Backup the data on a filesystem basis (tar, dar, cpio whatever the hell that does the job).
Delete the partitions, re-create them the required size, and restore the data.
This is, again, what you said.
Quote:
would tar (or dar) be more suitable for what am I trying to do?
Me.
Quote:
I have to ask, why the hand-wringing and complexity ???.
Because I'm on a slow internet connection and I can't afford wasting 3 1/2 - 4 hours (the happiest situation) only to apt-get the needed packages with a netinstall, plus few more days until I tweak everything to be as I want if something goes wrong. Add to this the fact that I currently have to pass some exams and what I'm doing to maintain my Linux system is done when I get a break (learning, etc.). And I'm doing it because I came to love Linux and not just fool around wasting time.
I read today around 40 more threads resembling somewhat to this. Also around 20 yesterday. None of them describes exactly what I want to do.
If my English isn't understandable, please let me know. I thought I asked (twice I might add) clearly which would be the best tool to backup data considering that it's going to be restored on a new, resized partition. Also, which is the best way to prevent data loss.
Quote:
Backup the data on a filesystem basis (tar, dar, cpio whatever the hell that does the job).
So which the hell does the damn job? If I do like you say (yet I doubt that i'll do that), if I (re)create from scratch my partitions, which tool is the best?
Quote:
What's so damned hard ???.
When you were a n00b, you never asked yourself "what if I fsck up my system? What will I do? Shall I go again and bother those nice people at the forum?"

Maybe this time someone will get what I'm asking and maybe I won't get only halves of answers.

Last edited by harken; 02-14-2005 at 08:51 AM.
 
Old 02-14-2005, 04:50 PM   #13
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Maybe this time someone will get what I'm asking and maybe I won't get only halves of answers.
You have had your whole answer. Not only that, but you yourself have indicated a knowledge of all the tools you need to do the job.

You are just nervous.
 
Old 02-15-2005, 01:52 AM   #14
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Original Poster
Rep: Reputation: 30
Yeah, you're probably right. Actually you ARE right. I'm sorry and I appologize for that...I was kind of tired (at 11 PM) reading so many posts with all kind of answers, none fitting me.

Anyway, I made it through using dar...it's a great tool and I warmly recommend it.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
Tar and partimage backup strategy jrdioko Linux - Software 1 06-08-2005 07:50 PM
partimage help bungle_42 Linux - Software 11 06-17-2004 09:40 AM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:00 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration