LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-29-2009, 12:16 PM   #1
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Rep: Reputation: 33
Smile Help me back up my computer


Hi everyone,

I have an ancient Linux installation (Mandrake 9.2, c.2003).

I have bought a USB external hard drive. I want to back up my files and e-mails. (I used KMAIL). Bookmarks would be nice too but not necessary.

I would soon like to install a newer distribution, so preserving the whole thing isn't needed. (i.e. no bare metal restore needed).

My partitions look like:

hdc1: Windows 2000 (which I will do separately)
hdc5: /
hdc6: swap
hdc7: /home

I think I only need to copy over /home, but, what settings would I need to have from the / partition? What command should i use to make sure the WHOLE thing is copied (hidden files, settings, etc)

Would my e-mail be compatible with another application (say the mail client in Debian or Ubuntu for instance?)

Also, how do I mount the USB device? I am not sure if I have USB support in this distro. (If not I could burn a CD or something)

TIA
 
Old 10-29-2009, 12:32 PM   #2
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,131

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
All your personal choices (as opposed to hardware-determined things like your monitor type and internet connection) are in the hidden files of /home, so backing up that will do. You won't want to backup everything: clear out the Firefox cache first, using Edit - Preferences - Privacy.

The simplest tool is:
rsync -a /home/ /media/disk
or whatever the external drive mounts as.

To keep a backup up-to-date, adding new files, replacing altered ones, and removing unwanted ones:
rsync -au --delete --exclude=/lost+found /home/ /media/disk

If your old installation won't mount the usb disk, download Insert Linux and burn it onto a CD. That's a great rescue kit, very useful if disaster strikes, and you can run it from the CD or load it into RAM. That will give you gnu-parted to format the external drive, and rsync to do your backup.
 
Old 10-29-2009, 12:45 PM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
KDE on Mandrake 9.2 stored mail in /home/username/Mail if I remember correctly. Maybe it was .Mail (and therefore hidden). Hunt around for it: locate inbox may help you narrow down the directory structure.

Bookmarks locations depend on your browser. Often they can be "exported" to a file, and then reimported.

Newer versions of KDE 3.5.x store mail in ~/.kde/share/apps/kmail/mail I have posted several threads to LQ describing how to get old emails transferred to a new version of kmail.

Please search for my username and kmail.

kmail's address book can be exported as a vCard file, then re-imported to the new version.

Email filters were more difficult - I had to re-create them.

USB support in 9.2 was poor - I'd recommend using a live cd. Knoppix is easy to use.

I'd also strongly recommend that you take images of your old partitions, and not delete them until you are absolutely sure there is nothing further you need to dig out (keep for a month or two at least):

As root do:
Code:
dd if=/path/to/root/partition of=/path/to/usb/oldroot.iso
dd if=/path/to/home/partition of=/path/to/usb/oldhome.iso
Be very careful with the above paths. Triple check before you press Return!

These .iso files can later be mounted on your newly installed distro with the loopback option (and "readonly", please!), and the .iso file will then appear at your mountpoint exactly as your old filesystem was. This will help you recover from those "Damn, I forgot to take a copy of ...." situations. It also makes it very easy to drag the files you need from your old distro to your new one.

Please let us know how you get on.
 
Old 10-29-2009, 01:30 PM   #4
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
In short:

1. Attach USB hard disk, wait a few seconds and run dmesg command:

Code:
sd 4:0:0:0: [sdb] 488397168 512-byte hardware sectors: (250 GB/232 GiB)
sd 4:0:0:0: [sdb] Write Protect is off
sd 4:0:0:0: [sdb] Mode Sense: 03 00 00 00
sd 4:0:0:0: [sdb] Assuming drive cache: write through
sd 4:0:0:0: [sdb] 488397168 512-byte hardware sectors: (250 GB/232 GiB)
sd 4:0:0:0: [sdb] Write Protect is off
sd 4:0:0:0: [sdb] Mode Sense: 03 00 00 00
sd 4:0:0:0: [sdb] Assuming drive cache: write through
 sdb: sdb1 sdb2
sd 4:0:0:0: [sdb] Attached SCSI disk
In the above case the hard disk is /dev/sdb device and has two partitions: /dev/sdb1 and /dev/sdb2.

2. Next run fdisk -l /dev/sdb command:

Code:
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       27126   217881596    7  HPFS/NTFS
/dev/sdb2           27135       30402    26236928    c  W95 FAT32 (LBA)
In the above case first partition is NTFS (7) and the second is FAT32 (c).

3. Because you want to backup Linux files it'll be better to use for that purpose Linux partition. So decide how to partition your new hard disk. The easiest way is to remove both partitions with fdisk and create one of the type Linux (83). Next decide what file system to use. If you have a lot of small files to backup the best will be ReiserFS. You'll create it with mkreiserfs /dev/sdb1 command.

4. Before backup it's good to rearrange your files in directories in a logical way and to remove unwanted files. So inspect your /home directory, throw away unwanted files and put the rest in the appropriate directory structure. You'd also clean cache of your browser.

5. Mount USB hard disk with mount -t reiserfs /dev/sdb1 /mnt/tmp command.

6. Prepare directories on that disk such as Mandrake_9.2/etc and Mandrake_9.2/home/user. Change owners of the user directory to your user and group.

7. Copy the contents of your /etc and /home/user directories to the appropriate directories on USB hard disk.

8. Take into consideration that new Mandriva, Debian or Ubuntu has different settings in /etc directory so after the installation of the new system don't copy mechanically the contents of your /mnt/tmp/Mandrake_9.2/etc directory over the files in new /etc directory. Instead of it use these files as a clues how you should modify your configuration files. Before modifying any file prepare its copy with cp -p file file.old command.

9. The same with dot files from your /mnt/tmp/Mandrake_9.2/home/user directory. New distribution could use different programs so some of old files could be unwanted or obsolete. Before modifying any dot file prepare its copy with cp -p .file .file.old command.

10. DISCLAIMER: I don't use Mandrake nor Mandriva so I'm not sure all the programs mentioned above are included in these distributions. Feel free to customize the above recipe to your needs.

***

I wrote my reply long so DavidMcCann and tredegar outran me.

Last edited by w1k0; 10-29-2009 at 01:33 PM.
 
Old 10-29-2009, 02:36 PM   #5
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
Thanks everyone for the awesome replies.

I didn't know I had to format my USB drive (the instructions say it "just works" on Windows and Mac). This drive will be mainly used for backup of multiple Windows machines (Win2K, XP and Vista) as well as my Linux machine plus one Linux server. As of right now though, it is brand new, never touched. I wanted to do my Linux first, so that I can install a new hard disk in my machine and upgrade my distro at the same time. If I use a Linux format I would be afraid the drive would no longer work with Windows. Is there a format I can use for both?

I have plugged my drive in and typed dmesg but there is nothing about any USB drive, only my regular boot messages. Plus, the light on the drive isn't on. I do have a Knoppix CD I can use, so I will try that.

Here are the last few lines of dmesg, I don't see any evidence my drive was detected:
Code:
Splash status on console 5 changed to on
inserting floppy driver for 2.4.22-10mdk
Floppy drive(s): fd0 is 1.44M
FDC 0 is a post-1991 82077
hda: attached ide-cdrom driver.
hda: ATAPI 48X DVD-ROM CD-R/RW drive, 1536kB Cache
Uniform CD-ROM driver Revision: 3.12
SCSI subsystem driver Revision: 1.00
[drm:radeon_unlock] *ERROR* Process 2451 using kernel context 0
Another question: how do I find out how big each partition (/ and /home) is before I start?
 
Old 10-29-2009, 03:19 PM   #6
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Avatar View Post
Is there a format I can use for both?
You can use FAT32 or NTFS and store Linux data with tar. Or you can use Linux ext3 file system and install in Windows a tool allowing to use that file system. Or you can divide your disk into two partitions: one for Windows backup and one for Linux one.

Quote:
I have plugged my drive in and typed dmesg but there is nothing about any USB drive, only my regular boot messages. Plus, the light on the drive isn't on.
So it's like tredegar said. Maybe it'll be enough to install new kernel in the system to mount USB device. Or try Knoppix according to tredegar's advice.

Quote:
Another question: how do I find out how big each partition (/ and /home) is before I start?
Use df -h command.

Last edited by w1k0; 10-29-2009 at 03:21 PM.
 
Old 10-29-2009, 04:33 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
I have plugged my drive in and typed dmesg but there is nothing about any USB drive,
As I said before, 9.2 had poor USB support (and it is ANCIENT now!): so please download and run a recent version of live-from-CD-knoppix. You might be pleasantly surprised, and unless you tell it to, it will NOT touch your HDDs.

Quote:
If I use a Linux format I would be afraid the drive would no longer work with Windows. Is there a format I can use for both?
Win doesn't like to see linux filesystems (I wonder why?)

Most win filesystems have a file size limitation (2Gb if I remember correctly) that may be too small to allow dd'ing an iso file of a complete linux filesystem as I suggested above.

I would prefer to format one partition on my external USB HDD as linux ext2 or ext3 and use that for my linux files.

It's ... just ... easier

You can then create and format another partition on your external HDD as win FAT32, and use that for windows. Linux will, of course, "see" both the FAT32 and linux formats. Win will not. That's just the way it is.

Win will "see" the win-formatted partitions, but ignore the linux ones. ( Again, I wonder why?).

Quote:
Here are the last few lines of dmesg, I don't see any evidence my drive was detected:
9.2 is too old to know how to use USB devices properly. It can be made to do so, but easier would be to boot a recent knopppix live CD distro, which will handle USB disks without problems. Do not use an old knoppix CD, as you are already way out of date, and remember that linux has improved hugely since mandrake 9.2.

Quote:
Another question: how do I find out how big each partition (/ and /home) is before I start?
Also see fdisk -l (you should run this as root). Put man fdisk into your search engine. Read the result. Tedious, I know, but that's the only way to learn.

You have 504 posts (to date), but you still seem uncertain. This worries me. If you are not sure what to do, please describe the situation (in all its gory details) and ask us again. We are here to help you.

So, I think you need to do the following:

Boot from a live CD (eg knoppix)

Plug in your USB disk.

Use fdisk -l to find out what disks and partitions are available on your USB disk.

Use fdisk to partition it into 2 partitions;
- one big enough to hold your linux files
- another big enough to hold your win files

Format each partition (FAT32 for win, ext3 for linux)

Copy files over. (Better, make an iso file as I suggested earlier, and copy that over.)

Check you can read the files from each OS.

Then you are good to go.

Do not delete anything from your original disk until you are really sure that you are happy.

Meanwhile, I think you should re-read ALL the posts in this thread and search on everything you do not COMPLETELY understand. You need to understand the concept of what you are trying to achieve, and how you might achieve that before you issue a single command.

Otherwise there might be sadness

Tread carefully, read, understand, and suddenly the light will turn on

Happy searching. Take care.
 
Old 10-29-2009, 05:23 PM   #8
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by tredegar View Post
Win will "see" the win-formatted partitions, but ignore the linux ones. ( Again, I wonder why?).
It's simple. Microsoft is aware of all weaknesses of their Windows (so called: ``operating systems'') so it doesn't allow to see them Linux partitions in order to protect them from the accidental damage or malicious compromise.

Last edited by w1k0; 10-29-2009 at 05:25 PM.
 
Old 10-30-2009, 10:59 AM   #9
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
Thanks for the replies, tredegar and w1k0.

Yes, I am still a newbie even after using Linux for 10 years. Mainly because once I get them set up, they run perfectly for a very long time and I don't have to do any work on them. Also, everything has to be done with command line, which if you do not know the commands, is like trying to learn a new language without a teacher. Maybe by the time I have 4,240 posts I will no longer be a "newbie"

I am in Knoppix (yes, a version from 2009!) and it did detect my USB drive. I can see it using fdisk -l. Thanks for breaking everything into steps. However, I have a Parted Magic disc here (also from 2009!) that I have used before with success so I am going to use that to partition my external drive if possible, rather than fdisk.

Just one question, if I make ISO files, can I still do a single file copy from within the ISO to my new filesystem in the future?

Okay, two questions: with an ISO created by dd, will the file be the same size as all the files or of the disk? For example, I have a 40 GB disk but only 6.2 GB are used (including the operating system), will my ISO be 40 or 6.2 GB? (from the dd man page: "dd can makes an exact clone of an (unmounted) disk, this will include all blank space so the output destination must be at least as large as the input")

The only other thing I am going to search on, is properly exporting my kmail e-mails. Otherwise I'm going to get started! This will be good learning.

Last edited by Avatar; 10-30-2009 at 11:28 AM.
 
Old 10-30-2009, 12:11 PM   #10
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Avatar View Post
Thanks for the replies, tredegar and w1k0.
You're welcome! Use ``thumb up'' icon to thank us in a more formal way.

Quote:
Maybe by the time I have 4,240 posts I will no longer be a "newbie"
Asking questions isn't enough. You have to learn. There is a lot of books and sites about Linux.

Quote:
Just one question, if I make ISO files, can I still do a single file copy from within the ISO to my new filesystem in the future?
As tredegar said you could mount it as a loop read only device, open it and extract selected files or directories.

Quote:
Okay, two questions: with an ISO created by dd, will the file be the same size as all the files or of the disk?
ISO created by dd is of the size of the entire partition so better is to use tar to store backup as I suggested above. When storing data on Linux partition it's enough to copy it (without dd or tar usage).

Quote:
The only other thing I am going to search on, is properly exporting my kmail e-mails. Otherwise I'm going to get started! This will be good learning.
Try it. If you'll succeed -- congratulations. If you'll fail -- start a new thread.

Last edited by w1k0; 10-30-2009 at 12:18 PM.
 
Old 10-30-2009, 12:31 PM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
Just one question, if I make ISO files, can I still do a single file copy from within the ISO to my new filesystem in the future?
Yes. That's the beauty of it:
(As root) Make a mountpoint on your new linux system
Code:
mkdir /mnt/oldhome
Now mount the iso file (it doesn't have to end in .iso, but it reminds me what those files are) as a read-only filesystem (in case of stupid mistakes).[ Obviously if your filesystem was ext3 you'll have to change the ext2 bit. The easiest way to check on this is to look at mandrake's /etc/fstab ]

Code:
mount -t ext2 -o loop,ro  /path/to/old/oldhome /mnt/oldhome
Now open up /mnt/oldhome and all your files will be there (even the hidden ones).
Copy them over, with the command line a file-manager, whatever.

Don't forget to unmount the file when you are finished, or the files may not be copied properly.
Code:
umount /mnt/oldhome
Okay, two questions: with an ISO created by dd, will the file be the same size as all the files or of the disk? For example, I have a 40 GB disk but only 6.2 GB are used (including the operating system), will my ISO be 40 or 6.2 GB? (from the dd man page: "dd can makes an exact clone of an (unmounted) disk, this will include all blank space so the output destination must be at least as large as the input")

The iso file made by dd will be the same size as the partition that was copied.

I see your HDD has 4 partitions, and the important linux ones are 5 and 7
If your HDD is 40GB, then partitions 1+5+6+7 cannot exceed 40GB, therefore each partition must be smaller than 40GB.
But, yes, dd copies even unused space.


@w1k0 - I type too slowly!
 
Old 10-30-2009, 12:41 PM   #12
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by tredegar View Post
@w1k0 - I type too slowly!
You were faster than me with your #3 post and I was faster than you with my #10 post. It's draw.
 
Old 10-30-2009, 05:23 PM   #13
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
Mission complete.

I used my Parted Magic disc to do the partitioning, although surprisingly it had problems with the FAT32 existing partition which i hoped to just resize (it had no problems with the NTFS disks I have done before). I had to delete it and make a smaller one. I made my Linux partition as ext3 just because that is what I am already using.

I ended up using the rsync suggestion by DavidMcCann, simply because I didn't feel my workstation stuff was that important to take up 34 GB of free space , especially as I will not be restoring the operating system. (BTW, my Linux half is 40 GB - the disk is actually 80 GB). However, I will probably use the dd/ISO imaging method for my servers so I can have a bare-metal backup of them. Also I will be keeping my hard drive for a while, so if rsync "forgot" anything I will still have it.

Anyway, everything went very smoothly and I didn't run into any problems with this computer, so thanks all for the good and detailed replies, and my servers are next
 
Old 10-30-2009, 06:11 PM   #14
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Please not NTFS has a HUGE security hole.
 
Old 10-30-2009, 06:45 PM   #15
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by Avatar View Post
However, I will probably use the dd/ISO imaging method for my servers so I can have a bare-metal backup of them.
To store the backup of my systems I use tar with gzip. Such backups occupy significantly less space than ISO images (uncompressed or compressed).
 
  


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
Cannot get Slack back onto this computer! 27thSunshine Slackware - Installation 20 03-16-2009 01:11 AM
Connecting 2 linux computer back to back with cross cable. michalng Linux - Networking 8 02-11-2009 07:00 AM
Auto-starting computer on power back avallach General 4 03-21-2007 07:31 AM
If I load Linux on to a computer will i be able to switch back? tsunamidave Linux - Newbie 9 01-07-2007 06:02 PM
Best way to Back Up a computer?? Balarabay1 SUSE / openSUSE 8 08-08-2006 08:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:17 AM.

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