LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   file storage while switching distros (https://www.linuxquestions.org/questions/linux-newbie-8/file-storage-while-switching-distros-648706/)

VeganBikePunk 06-11-2008 11:24 PM

file storage while switching distros
 
I'm about to switch from BLAG (a fedora spin) to ubuntu. Is there any way to keep everything in my home folder, or is there a place where I can store like 50 gigs of music and videos for a couple hours while I switch? Or do I have to burn like 60 CDs?

jpwigan 06-11-2008 11:44 PM

Depends on whether or not you have /home on a separate partition. If /home has its own entry in 'mount', then you have it on a separate partition. In that case, when you install Ubuntu, you can tell the installer that that partition is /home and that it should NOT be formatted. This should preserve all of your data.

If you don't have /home on a separate partition, things get trickier. If you have an external hard drive, you could always dump it there. :P If not, you *might* be able to resize some other partitions and make a new partition for /home, then follow the above suggestion. That depends on a number of variables, though, and it's potentially dangerous even if its possible. To advise you more on that, I'd need to see the output of 'fdisk -l', 'mount', 'pvs', 'vgs', and 'lvs'.

VeganBikePunk 06-12-2008 12:01 AM

I don't think I have a seperate /home partition (though next time I may). I do have a windoze partition. And no external HD (or I'd use that of course)

Code:

[thirtysix@localhost ~]$ sudo /sbin/fdisk -l
Password:

Disk /dev/sda: 164.6 GB, 164696555520 bytes
255 heads, 63 sectors/track, 20023 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        2550    20482843+  7  HPFS/NTFS
/dev/sda2            2551        2563      104422+  83  Linux
/dev/sda3            2564      20023  140247450  8e  Linux LVM

Disk /dev/sdb: 4026 MB, 4026531840 bytes
220 heads, 32 sectors/track, 1117 cylinders
Units = cylinders of 7040 * 512 = 3604480 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1  *          1        1118    3932143+  c  W95 FAT32 (LBA)

Disk /dev/dm-0: 142.5 GB, 142505672704 bytes
255 heads, 63 sectors/track, 17325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

Code:

[thirtysix@localhost ~]$ sudo /sbin/pvscan
  PV /dev/sda3  VG VolGroup00  lvm2 [133.75 GB / 32.00 MB free]
  Total: 1 [133.75 GB] / in use: 1 [133.75 GB] / in no VG: 0 [0  ]


jpwigan 06-12-2008 12:30 AM

Well, looks like your Volume Group is fully used. You could try shrinking the root partition and creating a separate /home, if you've got the free space. You'd have to do it from a LiveCD, of course (I'd recommend the rescue mode on the Install CD, if BLAG has a rescue mode), and you need the available space. What's the output of these two commands?

lvs
df -h

VeganBikePunk 06-12-2008 02:34 AM

Code:

[thirtysix@localhost ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      129G  65G  58G  54% /
/dev/sda2              99M  19M  76M  20% /boot
tmpfs                252M    0  252M  0% /dev/shm
/dev/sdb1            3.8G  1.6G  2.3G  41% /media/disk

Code:

[thirtysix@localhost ~]$ /usr/sbin/lvs
  No volume groups found

I'm going to need to be walked through this resizing partition tabling jazz.

jpwigan 06-12-2008 11:52 AM

Strange that there are no volume groups found - you clearly have a volume group mounted. Make sure you run these commands as root.

Anyway, LogVol00 has 58 GB of free space. Assuming that's enough, we can shrink it and move /home to a new Logical Volume. I will admit now that I'm not sure how elegantly Ubuntu's installer handles LVM, though. I've only installed Ubuntu twice, and only used it for a couple months... never did anything too fancy. Hopefully someone else can attest to whether this will result in something Ubuntu can use without clobbering.

Also, I'm assuming your partitions are ext3. Throw the output of 'mount' up here on your normally running system if you're not sure whether this is true.

To do this, get the machine booted into a rescue mode or LiveCD (if the install disc has a rescue mode, that's preferable. It will help ensure that the tools are all versions that are compatible with your installation).

When you boot, make sure you choose NOT to mount your filesystems, if prompted. Once you're at a shell, you may need to scan for lvm devices. These commands may vary a bit from distro to distro, but this will typically work:

lvm.static pvscan
lvm.static vgscan
lvm.static lvscan
lvm.static vgchange -ay

Now, 'lvm.static lvs' should show your volume group. Shrink it with these commands:

e2fsck -f /dev/VolGroup00/LogVol00
resize2fs /dev/VolGroup00/LogVol00 69G
lvm.static lvm.reduce -L 70G /dev/VolGroup00/LogVol00
resize2fs /dev/VolGroup00/LogVol00

Notice the 3-step process there: shrink FS, shrink partition to something slightly larger, then re-grow FS. This is a sanity check that helps avoid a potentially bad situation where your FS extends past the end of your partition.

Now, you can create a new Logical Volume and put a filesystem on it:

lvm.static lvcreate -n home -L100%FREE VolGroup00
mkfs.ext3 /dev/VolGroup00/home

Now you can mount /dev/VolGroup00/home on a temp directory, copy everything in /home over to it, and you have everything from /home on a new partition. If you're going to keep using this install for a while, I'd recommend adding an entry to /etc/fstab to have /dev/VolGroup00/home mount on /home at boot, so any changes you make go to the correct partition.

VeganBikePunk 06-12-2008 11:13 PM

Code:

[thirtysix@localhost ~]$ sudo mount
Password:
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda2 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/dev/sdb1 on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=500)


VeganBikePunk 06-12-2008 11:22 PM

and so, the commands starting at lvm.static pvscan should be typed in during rescue mode of the ubuntu CD?

VeganBikePunk 06-12-2008 11:31 PM

also, can I get specific instructions for mounting the partition to a temp directory, and copying everything from home over to it. And I'm not going to be using BLAG for much longer at all, so the FStab alteration shouldn't be necessary, but I'm wondering if the ubuntu install will just know that /home is mounted there or if I'll have to add something to fstab there.

jpwigan 06-14-2008 10:42 PM

Yes, those commands are all from rescue mode. I thought the previous paragraph said so :)

In the Ubuntu install, you'll probably have to specify that the partition is /home, and tell it NOT to format the partition. I've never worked with the Ubuntu partition setup during install (always just accepted the defaults), so I don't know the exact procedure there. Like I said before, I don't even know how Ubuntu deals with LVM...

To mount & copy the data, though, I'd do something like this:

mkdir /tmp/root
mkdir /tmp/home
mount /dev/VolGroup00/VolGroup00 /tmp/root
mount /dev/VolGroup00/home /tmp/home
cp -pR /tmp/root/home/* /tmp/home/
umount /tmp/root
umount /tmp/home


All times are GMT -5. The time now is 04:16 PM.