LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 07-05-2007, 05:10 AM   #1
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Rep: Reputation: 15
Switching distros and wanting to keep data


Hi all,

I have two Linux boxes both running Fedora 7 which I am thoroughly enjoying at the moment. I have one for my development and university work and one for my music and backups, just to generally play about with. I wish to change the box with my music and backups to Slackware soon and I really want to be able to keep most of the data without having to backup everything onto a disk. There is roughly 100 GB of data spread out over two physical hard disks. My fdisk -l output looks like this:

Code:
[root@server1 ozone]# /sbin/fdisk -l

Disk /dev/sda: 157.1 GB, 157140189184 bytes
255 heads, 63 sectors/track, 19104 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       19104   153348457+  8e  Linux LVM

Disk /dev/sdb: 74.3 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        9039    72605736   8e  Linux LVM
I want to be able to keep all this and still change to slackware, is this possible or will I need to wipe everything?
 
Old 07-05-2007, 05:27 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Yup - you gonna have to do a wipe.

You should consider archiving the data you want to keep in several tarballs. Depending on what the files are, this can reduce the space considerably. Don't bother saving anything related to the OS, including hidden files in your home directory.

When I did this, I used an extra HDD for backup.
Now is a good time to think about a backup strategy.

When you repartition for the slackware install, make a separate data partition (in case you want to do it again).
 
Old 07-05-2007, 05:42 AM   #3
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks for the reply. So, just so I'm clear. I save my stuff, back it up etc. Then, when I am installing slackware, create a partition just for data that I wouldn't need to format in the event of switching again?? So if I had 4 partitions

/
/home
swap
/data

the /data one could be transferred to other distros?
 
Old 07-05-2007, 05:44 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Yeah just like that. Personally I just create a separate /home and leave the stuff there, no need to format that. It also keeps my personal (per-user) settings safe, because they're saved under homedirs.
 
Old 07-05-2007, 06:25 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I would also have a small partition for /boot. You can easily back it up then. Including an image backup, using dd and piping that through gzip or bzip2 to reduce the size.

With a separate /home partition, you can rename your old home directory (e.g. /home/username -> /home/username-old) and reuse the partition. During the installation, the new partition will have different hidden .kde or .gnome2 directories, But it is a simple matter to copy the Documents/ contents to your new /home/username directory. After copying over what you want to keep, you can delete the old directory.

Take care if the next distro uses a different range for user UIDs. Fedora starts at 500, while SuSE and maybe slackware starts at 1000. So run "chown -R username.groupname /home/username-old" before copying stuff back if the UID is different.
 
Old 07-05-2007, 06:25 AM   #6
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
The common approach is to create 4 partitions... swap, boot, root and home. (hmmm... sounds like a kinky website, but I digress...)

The idea is that when you upgrade, you do a clean install and tell the installer not to touch the home partition; just mount it on /home. Since you are used to fedora, you may be familiar with the history of the "upgrade" process?

With slackware, this is probably a good idea too.

In your case, you may want to switch distros again, at some time. Your personal settings may not be compatible with the new system but you still want to keep your ogg/vorbis collection and all those celebrity-fakes pngs.

Thus, when you change distro, you want /home to get changed but leave the data partition alone, but mount it on /home/user/data or /share/data or whatever. Then you will always have your ~/data/music/ and ~/data/celeb-fakes/ directories unmolested.

There are a lot of different strategies... the point is to be aware that you don't have to format a partition for the installer to accept it (though you usually need to use an installers "advanced" or "expert" mode.)

Partition schemes can got quite complex in their interplay... you can have your /home partition on a different machine for eg. You can "harden" your /boot partition by archiving it to someplace else (encrypted and the works). Then rig the boot process to restore /boot from the secure archive first. As long as you make a new backup at each kernel upgrade you'll be fine.

If you put all your partitions in an LVM group, then you can resize on the fly should you discover you didn't leave enough space for something.

But right no, you should be thinking about future-proofing your distro. If you do not expect to switch distros a lot, then the four partition scheme is fine. Just remember: there is no substitute for good backups.

Last edited by Simon Bridge; 07-05-2007 at 06:34 AM.
 
Old 07-05-2007, 07:59 AM   #7
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks for the in-depth responses. So, if you can bear with me just to make sure I have this clear.

1. Backup all the things I want kept from my Fedora installation to transfer to my Slackware one.

2. Create 4 partitions root, swap, boot and home

Now, what I am struggling to understand is when Simon went on to explain about some settings not being compatible if I switch distro again (which may well happen, I like trying out new ones), I should be mounting my data (data as in my org/vorbis and celebrity fakes **You been looking at my computer Simon?**) to my new home drive. This is the part that confuzzles me.

So, lets just say, for arguement's sake, that I have backed up my data onto a portable HDD. I clean install Slackware onto my computer, at the same time making sure I create 4 different partitions (the afore mentioned ones).

My next few questions are (sorry if these are completely obvious)

1. How do I ensure my new data that I acquire will be saves onto /home (which is the one I want be upgradeable??).

2. If I did switch distros to, say Debian. Would I only need to wipe the /, /boot and swap to get a new distro installed and have the data kept?

3. Why would I put the /boot in a partition on its own? Is it because I could always boot the computer even if the boot section got corrupted?

Thanks for your time, it really is appreciated.
 
Old 07-05-2007, 10:46 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by RoughEdge
Thanks for the in-depth responses. So, if you can bear with me just to make sure I have this clear.

1. Backup all the things I want kept from my Fedora installation to transfer to my Slackware one.

2. Create 4 partitions root, swap, boot and home

Now, what I am struggling to understand is when Simon went on to explain about some settings not being compatible if I switch distro again (which may well happen, I like trying out new ones), I should be mounting my data (data as in my org/vorbis and celebrity fakes **You been looking at my computer Simon?**) to my new home drive. This is the part that confuzzles me.

So, lets just say, for arguement's sake, that I have backed up my data onto a portable HDD. I clean install Slackware onto my computer, at the same time making sure I create 4 different partitions (the afore mentioned ones).

My next few questions are (sorry if these are completely obvious)

1. How do I ensure my new data that I acquire will be saves onto /home (which is the one I want be upgradeable??).

2. If I did switch distros to, say Debian. Would I only need to wipe the /, /boot and swap to get a new distro installed and have the data kept?

3. Why would I put the /boot in a partition on its own? Is it because I could always boot the computer even if the boot section got corrupted?

Thanks for your time, it really is appreciated.
1) I'm not sure what you mean by new data I aquire. If you have the information in the home partition, such as in /home/roughedge/ogm/, and you reuse the old home partition without formating, then first rename /home/roughedge to something else, such as /home/roughedge-old, and after the install, move the /home/roughedge-old/ogm directory to /home/roughedge/ogm. Since it is on the same filesystem, it will be fast, because technically, you are just moving the inode entries between directories and not the file contents.
It is a good idea to back it up anyway in case something goes wrong.

2) You would only need to delete the (/) and boot partitions. You can reuse the same swap partition. The install program will probably detect it and ask if it is OK to mount it during the installation process.

3) A small boot partition is easy to backup and restore because it will probably be under 100MB. Suppose that the MBR got damaged or changed, such as after reinstalling XP, and you have your disk partitioned as (hd0,0)=XP; (hd0,1)=/boot; (hd0,2)=Swap; (hd0,4)=/; (hd0,5)=/home. You could boot up with your rescue or install disk, and get to the grub menu. Then go to the grub shell, and enter:
configfile (hd0,1)/grub/menu.lst
boot

This will give you your original boot menu and allow you to boot into linux and run grub-install to get the grub mbr back.

Last edited by jschiwal; 07-05-2007 at 10:49 PM.
 
Old 07-05-2007, 11:34 PM   #9
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by RoughEdge
Thanks for the in-depth responses. So, if you can bear with me just to make sure I have this clear.

So, lets just say, for argument's sake, that I have backed up my data onto a portable HDD. I clean install Slackware onto my computer, at the same time making sure I create 4 different partitions (the afore mentioned ones).
Gotcha...[/quote]1. How do I ensure my new data that I acquire will be saves onto /home (which is the one I want be upgradeable??).[/quote]If you want to keep the portable drive as a data drive... then you would plug it in and the OS automounts it someplace you can find... usually a subdirectory of /media like /media/usbdrive0 ... an icon appears on your desktop.

If this is a sata or ide drive, you edit fstab to mount the drive to wherever you want.

Otherwise you just copy the data you want over to the appropriate directories.
Quote:
2. If I did switch distros to, say Debian. Would I only need to wipe the /, /boot and swap to get a new distro installed and have the data kept?
You needn't wipe swap.

Let us say you have 2 drives, both sata, set up as follows:
sda1 /boot
sda2 /
sda3 /home
sdb1 swap
sdb2 /home/data

the installer detects these and displays their device file names but not their roles. It will ask you to specify the roles by allocating the filesystem and mountpoints.

You tell the installer to leave sdb2 alone. Allocate the mountpoints as before, including sdb1 as swap. Set only sda1, sda2, and sda3 to be formatted or initialized or whatever.

If you were updating an existing an existing distro, you would exclude sda3 from the format list.

But if data is on a removable drive, just remove it for the installation.
Quote:
3. Why would I put the /boot in a partition on its own? Is it because I could always boot the computer even if the boot section got corrupted?
Allows for clearer backups and hardens your system (/boot is usually mounted ro).

Mostly it is a good discipline.
 
Old 07-06-2007, 03:06 AM   #10
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks to all for the in-depth explanation of the partitions and how the work. I have downloaded the new Slackware 12.0 and will be buying a portable HDD to back up my current stuff, hopefully next week. I will keep you all posted and let you know if I have any problems.

Thanks again
 
Old 07-07-2007, 01:27 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
It may work out better if you reformat the external drive to a native linux filesystem. If it has a fat32 partition, then it doesn't save linux ownership or permissions with the file. If you use tar to backup the files, then the tar command would backup the standard ownership and permission information in the archive, but the fat32 filesystem has a filesize limit of 2 GB.

Actually you can get around this limitation by piping the output of tar through the split program. For the benefit of other readers of this post who have a Fat32 external drive that already has stuff on it, I'd suggest using par2 to create parity files incase one of the slices gets damaged. You can use cat to reassemble such a sliced backup and then pipe that into tar. You don't need to reassemble the parts to a file.
Here is an example where I backed up a single directory and restored it this way. Please note that the slice size I chose is very small because I am not backup up a lot of data for this demonstration. Also, I am restoring it to a different location then the original, because being a demo, I didn't want to reformat my home directory!
Code:
tar -cvf - work/ | split -d -b 1m - /media/NetDisk/workbu.tar.gz.
par2create -r20 -f0 /media/NetDisk/workbu.par2 /media/NetDisk/workbu.tar.gz.0*

> ls /media/NetDisk/workbu.*
/media/NetDisk/workbu.par2       /media/NetDisk/workbu.tar.gz.05        /media/NetDisk/workbu.vol007+008.par2
/media/NetDisk/workbu.tar.gz.00  /media/NetDisk/workbu.tar.gz.06        /media/NetDisk/workbu.vol015+016.par2
/media/NetDisk/workbu.tar.gz.01  /media/NetDisk/workbu.tar.gz.07        /media/NetDisk/workbu.vol031+032.par2
/media/NetDisk/workbu.tar.gz.02  /media/NetDisk/workbu.vol000+001.par2  /media/NetDisk/workbu.vol063+064.par2
/media/NetDisk/workbu.tar.gz.03  /media/NetDisk/workbu.vol001+002.par2  /media/NetDisk/workbu.vol127+128.par2
/media/NetDisk/workbu.tar.gz.04  /media/NetDisk/workbu.vol003+004.par2  /media/NetDisk/workbu.vol255+145.par2
# Next the command to list the archive. I won't post all of the results to save space.
Code:
cat /media/NetDisk/workbu.tar.gz.0* | tar -tf - | less

work/
work/shell/
work/shell/empty/
work/LearningXML/
...
To restore from the backup is similar:
Code:
cat /media/NetDisk/workbu.tar.gz.0* | tar -C ~/Documents/ -xvf -
 
Old 07-07-2007, 01:50 PM   #12
RoughEdge
Member
 
Registered: Jan 2004
Location: Scotland
Distribution: Slackware 12
Posts: 67

Original Poster
Rep: Reputation: 15
Cool, so when I get my external HDD, I should use something like ReiserFS or Ext3? Is that what you mean? How would I go about that. The HDD that I am looking at is a usb powered one. So, if I install a clean install of Slack, with all my partitions, should I then plug in my HDD after I have installed everything and mount it. Then use fdisk to format it?

Thanks
 
  


Reply



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
Switching to other distros... cyberbuff Linux - Newbie 10 12-31-2006 12:59 AM
Switching Distros naraht Linux - Newbie 3 08-03-2005 04:37 AM
Switching distros..... AudioMechanic Linux - Distributions 5 09-05-2004 07:02 PM
Switching Distros claudius753 Linux - Newbie 1 02-19-2004 04:18 AM
Switching Distros thcmwz Linux - Software 1 11-27-2003 10:45 AM

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

All times are GMT -5. The time now is 07:58 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