LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
Search this Thread
Old 08-25-2003, 07:01 AM   #1
comatosebuddha
LQ Newbie
 
Registered: Aug 2003
Location: Kolkata, West Bengal, India
Distribution: Fedora Core 3, SUSE 9.1
Posts: 10

Rep: Reputation: 0
migrating /usr/share to another hd


I have a RH 8.0 on a 80 GB dualboot with WinXP. My 2.0GB root drive has run out of space and I need to move files to another hd partition with 15 GB space. The only alternative to imaging my linux installation and moving it in entirity to the other hd seems to me to be to move certain directories to the other drive and symlink to it in the root. Is it possible? How should I go about it? My /home dir is already on the other hd partition.
Also, is there some util for converting existing FAT32 partitions to ext2/3 without data loss?
 
Old 08-25-2003, 09:50 AM   #2
MacKtheHacK
Member
 
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111

Rep: Reputation: 15
Do you have an unused partition on your drive, or are you wanting to just move the contents of your /usr into an existing filesystem that has more free space?

If you have an unused partition, you need to create a new filesystem within that empty partition. Use the mkfs command to do this. Do you know the pathname for your partition? If it's an IDE disk, it's /dev/hda6 if it's the second extended partition on your first drive, for example.

Once you've created the filesystem, mount it on top of some existing, empty directory. I usually make a new one like /usr.new and mount it there. Then copy all the files in /usr to your new filesystem with "cp -a /usr /usr.new". The -a option (for "archive") means to copy recusively and preserve all permissions, owners, etc.

Now you need to turn your copy into the real /usr. You probably can't unmount /usr because processes are using it, so bring your system down to single-user mode with "telinit 1". That tells the init program to change to run-level one, which will kill off most of the processes running on your system. You can then replace your /usr with your /usr.new by doing this:
umount /usr
mv /usr /usr.old
mv /usr.new /usr
mount /usr

Then do "telinit 5" to bring your system back up to it's usual run-level. Check to make sure everything works right with the new /usr filesystem. Once you're happy with it, you can remove the old /usr with "rm -rf /usr.old", and you'll at last have more space on your root filesystem.

If you have already made filesystems in all your partitions, then you can't do the above. You need to copy the contents of /usr into an existing filesystem with more space. Let's say your partition with 15GB of free space contains your /home filesystem. What you want to do is put all of /usr under /home somewhere, and make /usr be a symlink to the new place. There are some similarities to the above, so I'll just list the commands:
mkdir /home/usr
cp -a /usr /home/usr
telinit 1
umount /usr
mv /usr /usr.old
ln -s /home/usr /usr
telinit 5
Make sure everything works, then remove /usr.old.

Gee, I guess I didn't read your entire post, because you answered my first question. Well, use the second method.

I don't know if any FAT32 converters exist. I'd Google for "Linux FAT32 to ext convert" and see what shows up.
 
Old 08-25-2003, 10:05 AM   #3
fancypiper
Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 57
Here are some general instructions I wrote up when I decided to re-partition my drives.

# Clone a distro to another drive or move directories around
Install drive in box (assuming IDE1 slave for examples) and ensure BIOS can detect it. Boot into Linux and login to your user's account. Open an x terminal and partition and format the new drive as you wish
Code:
[fancy@tinwhistle fancy]$ su -
Password: 
[root@tinwhistle root]# fdisk /dev/hdb
Exit with w to write the partition table.

Format the partitions with the chosen filesystems:
mke2fs /dev/hdbX -> ext2
mke2fs -j /dev/hdbX -> ext3
mkswap -> swap
mkreiserfs -> reiserfs
mkfs.xfs -> xfs

Make directories for source and destination mount points. You need these to keep out of an endless loop of copying itsself over and over.
Code:
[root@tinwhistle root]# mkdir /mnt/source
[root@tinwhistle root]# mkdir /mnt/destination
Mount your os partitions that you want to clone on /mnt/source
Mount your partitions on the new drive, making directory entries for your separate partitions (/boot, /home, /var etc.). If you are just copying a directory such as var, just cd to the directory you wish to copy instead of mounting partitions on /mnt/source.

Now, cd to /mnt/source and pipe it over with tar
Code:
[root@tinwhistle root]# cd /mnt/source
[root@tinwhistle source]# tar cf - . | (cd /mnt/destination && tar xBfp -)
Edit /etc/fstab as needed, install the boot loader if you moved a whole distro, and it should work when it is installed in it's final position.

I don't know of any program that will allow Microsoft filesystems to be converted into Linux native ones. Copy the stuff you need to where you have room, then format the Microsoft partition in the format you want and move the stuff back.

Last edited by fancypiper; 08-25-2003 at 10:08 AM.
 
Old 08-26-2003, 03:10 PM   #4
comatosebuddha
LQ Newbie
 
Registered: Aug 2003
Location: Kolkata, West Bengal, India
Distribution: Fedora Core 3, SUSE 9.1
Posts: 10

Original Poster
Rep: Reputation: 0
Thanx for the help.
I could not preserve the data in situ in the other drive but as most of it was dvd video i compressed it (that's what i was doing the last 48 hrs!), burnt it on cd and spaced myself out a bit. Fdisked the fs type to ext3, and copied /usr to /usr.new.
As of now my installation is not giving any problems, but is it too early? I'll know for sure by tomorrow i guess.
In the meanwhile, thanx once again for the help - really appreciated.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete /usr/share directory? t3___ Linux - Newbie 4 03-09-2005 07:54 PM
deleted /usr/share jmoschetti45 Linux - General 1 11-20-2004 04:02 PM
/usr/share - What's the point? Makaelin Slackware 5 09-02-2004 06:05 PM
Cannot open /usr/share/sendmail-cf/m4/cf.m4 atomicx Linux - Networking 3 01-02-2004 09:44 AM
/usr/share/locale chrismiceli Linux - General 1 08-09-2003 10:39 PM


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

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