Hi folks,
My hard disk has been getting rather full recently so I added a second disk yesterday to take some of the strain.
Originally everything (apart from swap) was on /dev/hda5.
I have installed the small new disk as /dev/hda and created a "/" and "/home" partitions on it and moved everything from hda5 onto these two partitions apart from /usr which remains on /dev/hda5 and now has room to expand a bit more as I install additional programs.
Problem: I was going to mount /dev/hda5 on the new "/" as "/usr" but it has just occurred to me that the "usr" tree is actually still on /dev/hda5 as "/usr" rather than being in the top directory.
I do not have enough free space on any of my petitions to use as a temporary holding area to copy the contents of the "/usr" while I move it up one level so I have temporarily got round this problem by mounting /dev/hda5 as "/old" on the new "/" and making the new "/usr" a symbolic link to "/old/usr" but was wondering if there was a simple way to shift the contents of "/usr" up one level on /dev/hda5?
The PC boots and runs ok after tweaking fstab and lilo.conf; I am just interested in shifting usr to keep admin simple.
Any suggestions welcome.
Ian.
Ooops! Got confused with my hda and hdb.... Corrected version:
Hi folks,
My hard disk has been getting rather full recently so I added a second disk yesterday to take some of the strain.
Originally everything (apart from swap) was on /dev/hda5.
I have installed the small new disk as /dev/hda and created a "/" and "/home" partitions on it and moved everything from the old hard disk partition (now hdb5) onto these two partitions apart from /usr which remains on /dev/hdb5 and now has room to expand a bit more as I install additional programs.
Problem: I was going to mount /dev/hdb5 on the new "/" as "/usr" but it has just occurred to me that the "usr" tree is actually still on /dev/hdb5 as "/usr" rather than being in the top directory.
I do not have enough free space on any of my petitions to use as a temporary holding area to copy the contents of the "/usr" while I move it up one level so I have temporarily got round this problem by mounting /dev/hdb5 as "/old" on the new "/" and making the new "/usr" a symbolic link to "/old/usr" but was wondering if there was a simple way to shift the contents of "/usr" up one level on /dev/hdb5?
The PC boots and runs ok after tweaking fstab and lilo.conf; I am just interested in shifting usr to keep admin simple.
Any suggestions welcome.
Ian.
"Ian Douglas" alug@k1ngph1cher.com writes:
I do not have enough free space on any of my petitions to use as a temporary holding area to copy the contents of the "/usr" while I move it up one level so I have temporarily got round this problem by mounting /dev/hdb5 as "/old" on the new "/" and making the new "/usr" a symbolic link to "/old/usr" but was wondering if there was a simple way to shift the contents of "/usr" up one level on /dev/hdb5?
Yes - just mv them.
In detail:
cd /old/usr mv * ../ # mv .* ../ # if there are any dotfiles in /usr, which is unlikely cd / umount /old rmdir /old rm /usr # i.e. remove the symlink mkdir /usr # edit fstab to make /dev/hdb5 mount on /usr rather than /old mount /usr
You'll need to be root and not have anything that depends on /usr running (lsof helps if you have trouble with this). I've not tested this directly, obviously...
On 15-Jun-03 Richard Kettlewell wrote:
"Ian Douglas" alug@k1ngph1cher.com writes:
[snip]
In detail:
cd /old/usr mv * ../ # mv .* ../ # if there are any dotfiles in /usr, which is unlikely
^^^
A slight oops! here. Better is to write mv .??* .. otherwise you may find that you are trying to move . and .. as well, particularly if you are root. I still wear the scars of this one, even after 20 years messing with Unix.
cd /
---------------------------------- E-Mail: Raphael Mankin raph@panache.demon.co.uk Date: 16-Jun-03 Time: 10:46:42 ----------------------------------
Raphael Mankin raph@panache.demon.co.uk writes:
On 15-Jun-03 Richard Kettlewell wrote:
# mv .* ../ # if there are any dotfiles in /usr, which is unlikely
^^^
A slight oops! here. Better is to write mv .??* .. otherwise you may find that you are trying to move . and .. as well, particularly if you are root. I still wear the scars of this one, even after 20 years messing with Unix.
You get an error message from it, but it still does the right thing in practice.
mydir$ ls -a . .. .a .b .c mydir$ mv .* .. mv: cannot overwrite directory `../.' mv: cannot overwrite directory `../..' mydir$ ls -a . .. mydir$
On 2003.06.15 09:43, Ian Douglas wrote:
Problem: I was going to mount /dev/hdb5 on the new "/" as "/usr" but it has just occurred to me that the "usr" tree is actually still on /dev/hdb5 as "/usr" rather than being in the top directory.
I do not have enough free space on any of my petitions to use as a temporary holding area to copy the contents of the "/usr" while I move it up one level so I have temporarily got round this problem by mounting /dev/hdb5 as "/old" on the new "/" and making the new "/usr" a symbolic link to "/old/usr" but was wondering if there was a simple way to shift the contents of "/usr" up one level on /dev/hdb5?
Yes, you can do:
cd /old/usr mv * .. cd .. rmdir usr cd / umount /old rm /usr mount /dev/hdb5 /usr
then update /etc/fstab to mount /usr from hdb5 in future.
Steve.
Steve Fosdick lists@pelvoux.nildram.co.uk writes:
mount /dev/hdb5 /usr
then update /etc/fstab to mount /usr from hdb5 in future.
...so you'll only discover that you edited /etc/fstab wrongly next time you reboot, rather than immediately.
If you edit fstab and then just do "mount", not only do you detect mistakes early, you have less typing to do as well.