Difference between revisions of "Freeing up space on hda1"
m |
m |
||
Line 1: | Line 1: | ||
{{Articles|FAQ|FreeLink|OpenLink}} | {{Articles|FAQ|FreeLink|OpenLink}} | ||
− | [[Image:Hda.png|thumb|350px|right|hda1-394MB | + | [[Image:Hda.png|thumb|350px|right|'''Default partition sizes'''<br>hda1-394MB<br> hda2-271MB<br> hda3-remaining |
]] | ]] | ||
__TOC__ | __TOC__ | ||
+ | |||
+ | |||
+ | ==Background== | ||
{{Postit|Note| there's also the alternative to increase hda1's size. You'll likely have to delete hda2&hda3 though, | {{Postit|Note| there's also the alternative to increase hda1's size. You'll likely have to delete hda2&hda3 though, | ||
and it's something you'll usually do before reflashing. | and it's something you'll usually do before reflashing. |
Revision as of 23:49, 13 September 2006
Contents
Background
Note |
![]() |
there's also the alternative to increase hda1's size. You'll likely have to delete hda2&hda3 though,
and it's something you'll usually do before reflashing. Upgrade (or replace) the existing LinkStation hard drive |
If you are running out of hard drive space on hda1 (the location of the OS, and the default location of installed programs), you can free up space by moving some of the files to hda3 (the large partition containing the network shares). You can then create symbolic links in the original locations, and should in that way be able to access your files as if nothing happened (for the most part). You could well run into problems if you do this with OpenLink. There are known issues related to how BusyBox uses symbolic links, and other issues might arise. Some issues are reported below. Proceed at your own risk.
Note that /dev/hda3 is mounted on either /mnt or /mnt/hda, depending on the type of LinkStation you have (the instructions below refer to the former. If /mnt/hda exists on your LinkStation, you will need to modify the commands accordingly.
OpenLink
/home
Moving the /home directory should be safe, but it will not save you much space unless you are going to store a lot of data in the home directory of users. This can be done as follows:
cp -Rdp /home /mnt rm -R /home ln -s /mnt/home /home
/usr/local
Moving the /usr/local directory should also be safe. This directory contains additionally installed software, and moving it should not disrupt any mission critical applications. This can be done as follows:
mkdir /mnt/usr cp -Rdp /usr/local /mnt/usr rm -R /usr/local ln -s /mnt/usr/local /usr/local
/usr - Fixing the busybox symlinks
![]() |
|
First method
This script makes the needed changes to all the busybox symlink, changing them from ../../bin/busybox links to /bin/busybox. Run it with the AWK program.
#!/bin/awk -f
BEGIN { FS=" " while ("ls -al /usr/bin | grep ../../bin/busybox" | getline) { system("rm /usr/bin/"$9) system("ln -s /bin/busybox /usr/bin/"$9) } while ("ls -al /usr/sbin | grep ../../bin/busybox" | getline) { system("rm /usr/sbin/"$9) system("ln -s /bin/busybox /usr/sbin/"$9) } }
Alternative method
The following has also been suggested as a fix to the symlink problem. It is a bit more work than the above method, but might be able to resolve non-busybox-related symlink problems as well.
If you follow the FAQ to move /usr to say, /mnt/hda/moved_folder/usr and symbolic-link it back, some relative links won't work. For example, /usr/bin/wget has the symbolic link ../../bin/busybox, and that would get resolved to /mnt/hda/moved_folder/bin/busybox, which does not exist. Therefore, you can link all unmoved directory under root back to this /mnt/hda/moved_folder:
ln -s /bin /mnt/hda/moved_folder ln -s /dev /mnt/hda/moved_folder ln -s /etc /mnt/hda/moved_folder ln -s /lib /mnt/hda/moved_folder ln -s /lost+found /mnt/hda/moved_folder ln -s /mnt /mnt/hda/moved_folder ln -s /proc /mnt/hda/moved_folder ln -s /root /mnt/hda/moved_folder ln -s /sbin /mnt/hda/moved_folder ln -s /sys /mnt/hda/moved_folder ln -s /tmp /mnt/hda/moved_folder ln -s /www /mnt/hda/moved_folder
FreeLink
/home
Moving the /home directory should be safe, but it will not save you much space unless you are going to store a lot of data in the home directory of users. This can be done as follows:
cp -Rdp /home /mnt rm -R /home ln -s /mnt/home /home
/usr
If you need more space than would be freed up by moving /usr/local, you can move the entire /usr directory instead. Since Debian(FreeLink) installs into /usr/bin and does not typically use busybox there should be no problems. If you are using busybox(OpenLink) but still want to move /usr, you must fix the busybox symlinks.
You can move the /usr with the following commands:
cp -Rdp /usr /mnt rm -R /usr ln -s /mnt/usr /usr
/var
Moving /var with OpenLink is strongly recommended against, as OpenLink runs it as a ramdisk, so it will be lost and recreated on each reboot. As far as is known, FreeLink does not use this ramdisk, but moving var could also be dangerous since if something goes wrong your LS may very well fail to boot as it cannot access /var for creating the pidfiles.
However, Debian does use quite a lot of space on /var, notably in /var/lib and /var/cache. Therefore, if you are running FreeLink and are installing a lot of additional software, you may need to move /var as well. This has been confirmed to work well for several FreeLink users.
If you choose to do so, these are the commands needed to move /var:
cp -Rdp /var /mnt rm -R /var ln -s /mnt/var /var
You could also choose to move only /var/lib and /var/cache. You would of course need to modify the commands accordingly.