Linux - GeneralThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I seem to be running out of space on my hd, and i'm sorta unsure about how to work my way around the problem. I have 2 hd's with lotta partitions:
1st hd has swap, mount point /, mount point /home, + 2 fat partitions (for file storage).
2nd hd has 2 nt partitions (i dualboot linux/win2000).
I've installed lotta progs on / and since i keep the source in /usr/local/src, the partition is full. I realise that i was too generous to /home.
What i plan to do is this: Free up 1 (or both) fat partitions, convert it to ext3 and edit fstab so it will be mounted at /usr. Is it that simple? Should i move the content of the existing /usr to the new partition before i mount it? Or will this wreck the system?
I think you have the right idea:
Free up FAT partition(s), make a linux filesystem (ext3 if you like) there.
Mount the new (empty) partition at /mnt/newpart
To keep things from changing while you are copying, go to single user mode.
Copy [I would not recommend 'move'] over EVERYTHING from /usr to /mnt/newpart. You might like to search LQ for how to do this reliably, keeping permissions etc. The last time I did this, I did it like this:
I recently moved my OS to a bigger drive. I moved home first in root with cp -a but then I moved the / root partition using a knoppix bootable cd (still using cp -a) - Keep the original as you will need it.
Once copied across you have to edit the fstab on the new partition, then rig lilo on the original OS so you boot the new OS partition. Once you're booted you can edit and run lilo so you can boot the new partition.
There are a couple of ways to do all this, and you can make an emergancy rescue cd if you are worried, but it does work. Once the new part is up and running a while and you are sure all is well, you can then reclaim all the old space
My current system is at /dev/hda, and i wanna move it to /dev/hdd (i just bought a new 160Gb hd). I have split the new drive into various partitions and mounted the new hd under /mnt like this:
/mnt/base (will be '/' on the new hd)
/mnt/storage (just for backup and file storing)
... to prepare it for copying from my current system on hda. Btw... i plan to use ext3, but can i safely use ext2 on any of these partitions? Or is journaling generally a good thing for all of them?
As you can see from my fstab; to do this i have removed the original /dev/hdd which had two ntfs partitions (win2000). I want this back into my box when linux is running on my new hd. There are probably some important files on /dev/hda1 (the boot partition) that somehow needs to be copied to the new hd? LILO refer to /dev/hda1 as the boot partition for win2000, but the os is located on /dev/hdd1 (which i have removed for the moment).
Phew... this looks like a mess to me Over the last 5-6 years i've had DOS, w95, w98, w2000 and various flavors of linux installed on my system....
Firstly, PRINT a copy of your lilo.conf file and make a boot disk in case you 'loose' linux as I once did. It took me ages to work out how to get it back. It has been recommended only to copy partitions that are not being used, so you might want to get hold of a copy of knoppix that can run from a cd and use knoppix to copy your data over. This also gives you the advantage that if you 'loose' your linux, you can have a version of linux (knoppix) to use to get it back!
I am not sure it is a good idea to have /boot as a separate partition. Why would you want to do that? I just have /boot as a directory in my / partition. Lilo goes on the MBR of the boot disk. [See later!]
Now format each partition as whatever you like. Journalling seems to be "a good thing", so I am using ext3
Now mount /dev/hdd1 as /mnt/newroot, and create in /mnt/newroot/ all the directories you currently have listed in / (your old or current root) EXCEPT /proc and /mnt. /proc is virtual, so there is no point in copying it, and if you think about it, trying to copy over /mnt could lead to a recursive nightmare. Make sure your new (empty) directories in /mnt/newroot/ have the same perms as the old ones in /
Ideally you now run something like knoppix direct from the CD. This will allow you to mount your old root partition at /mnt/oldroot, and your new root partition at /mnt/newroot. If you cannot do this, go to single user mode, and I think you should be OK. The idea is that the filesystem should not be active or changing whilst you are copying it, otherwise you may end up with a whole load of inconsistencies!
Copy the contents of each directory (except /proc and /mnt) like this:
So, that has copied everything over, but it is not ready to boot yet.
You need to edit /mnt/newroot/etc/fstab to reflect the fact that hdd1 is going to be your new / partition, and similar for the other partitions on hdd.
Now there is just one more problem: You can see from your fdisk output above that /dev/hda1 is your boot disk, and lilo is on that disk's MBR.
You need to reboot to your old linux on hda. Tell lilo about your new linux on hdd, and make a boot menu entry for linux-hdd.
Try booting your linux-hdd. Does it look ok and work ok?.
If so, you are almost ready to finish up. If not, go back and fix things up until you can boot and run linux-hdd from lilo.
Remember, lilo is still on the MBR of hda. If you remove hda you will not be able to boot hdd, even if you plug its cable into where hda was. You'll have to 'man lilo' to sort this out, as I am at work (and, er, not working it seems!). Maybe the thing to do is use fdisk to mark hdd as the boot disk, and then run /sbin/lilo to write its thing to the MBR of hdd, but I am not sure here.
Have fun, its an amusing exercise, and highly satisfying when you finally get it right.
Maybe you'd like to condense this thread into a HOWTO as this sort of problem seems to crop up fairly often.
Do not #rm -RF anything from hda until you are completely happy that all is well set up on hdd.
When i finally started, it took me only about a couple of hours. I thought of running Knoppix from a cd, but decided i wanted to try without, and i had no problems.... Mounted the new disk, created the directories on hdd1, mounted the other partitions on hdd1, copy everything to it besides /mnt and /proc (i learned that also applied to /sys on my system - slackware 10), edited fstab on hdd & added a hdd1 entry in lilo.conf. Now i'm running from hdd
The only thing left for me to do is to install lilo on mbr on hdd & remove the old disk. (update: i just did that. installed lilo with: "lilo -b /dev/hdd1", edited fstab, removed hda, reboot - all ok) Thanks for all help.