Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Okay so I got an SSD for my notebook and I'm currently setting up my system. On the SSD I'd like to have the main OS (Crunchbang in this case) and maybe some swap whereas on the HDD I want my Home directory and pretty much everything unrelated to the system itself.

Since I'm not quite fit with filesystems, what would be a good way of partitioning and mainly, how can I achieve the separation described above?

share|improve this question
    
Your question isn't very clear. Are you trying to move directories of an installed OS to partitions on a new SSD that you added to the machine? –  tink Jan 16 '13 at 19:10
add comment

1 Answer

up vote 1 down vote accepted

Definitely put your swap on the SSD; this is particularly handy if you use suspend-to-disk (aka. hibernate), because the disk it uses is the swap partition.

Linux distro installers often provide a means of putting home (or whatever) on a separate partition; I've never used crunchbang but if there is a stage where you pick your partition and such, you can probably also do this then by adding another partition and giving it a mountpoint of /home.

If you don't or can't do it then, it is pretty easy to do at any point subsequently (so if you don't want to bother until the SSD starts to fill up, you can wait). You probably want to log out and do it as root (not sudo, log in as root) so that moving your current /home won't screw anything up.

First you need to temporarily mount the new, formatted partition somewhere so that you can copy into it.

The next step once you are sure all users with a $HOME in /home (root is not) are logged out and no process owned by same are running (check with ps -o cmd,user,group -A | grep <user name>) is to move the stuff in /home into the temporarily mounted partition, using whatever tool you would normally use to move such stuff (eg, a file browser or rsync). You don't want to move /home itself, but you want to move everything in it.

Now unmount the partition from /mnt or whereever, then remount it on home, eg:

mount /dev/sdb1 /home

The system is now the same way it was before, just with the home stuff on another device. The last thing to do is add a line to /etc/fstab so that the home partition will be auto-mounted at boot time. It is a good idea to use the disk UUID instead of the device node label for this; you can find that out with ls -l /dev/disk/by-uuid (exactly like that, verbatim). The line in fstab should look something like this:

UUID=<the uuid> /home ext4 defaults 0 2

Keep in mind that if you reformat the disk at some point, its uuid will change. If you would rather just use the device node, use just that (eg, /dev/sdb1) but beware those can all change at boot time if you have attached or removed some disks (which is why the uuid is a bit safer). Have a look at man fstab to understand the fields; obviously if the partition is not ext4 you want something else there. The last two should be fine (unless you use dump to backup, but you would know if you do and you probably don't).

One thing to beware of when doing this are hard links. Soft links will be fine, as the directory tree has not changed at all, but hard links (you probably won't have any, especially on a new install) cannot span multiple devices.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.