[kwlug-disc] Adding (setting up) 2nd disk.
zixiekat at gmail.com
Tue Jan 26 15:07:34 EST 2010
I've never done that before, but from looking around a little I found
out the mount command 'mount -o bind' (or 'mount --bind), which
basically allows you to mount a directory into another directory...
So mount the second partition into /mnt/disk2, then use the 'mount -o
bind' command to mount /mnt/disk2/home /home and /mnt/disk2/data /data
I've never used this command before, so you may want to do a little
research before going for it. :)
A few links I found after Googling for 'mount -o bind' and 'mount --bind':
On Tue, Jan 26, 2010 at 3:00 PM, unsolicited <unsolicited at swiz.ca> wrote:
> Thanks for the note. I get all this. Or I'm still missing something. The
> instructions still seem to be putting /home and /data on different
> partitions, not the same one.
> (It's a laptop - there ain't gonna be any more disks or partitions, and it
> isn't going to grow any. Otherwise, I probably would have used LVM.)
> What I don't get is how both /home and /data are on the second disk
> (partition actually, but never mind that), if fstab is mounting /home at
> /dev/sda6. (When / is /dev/sda3.) How is /data on the 2nd disk set up?
> Unless fstab mounts /disk2 at /dev/sda6, I create /disk2/home and
> /disk2/data and create /home and /data as links (hard?) there.
> Good search terms for such aren't occurring to me.
> Thanks for any thoughts.
> john at netdirect.ca wrote, On 01/26/2010 10:46 AM:
>> kwlug-disc-bounces at kwlug.org wrote on 01/26/2010 08:39:14 AM:
>>> I'm setting up a kubuntu 9.10 box, 3 partitions: OS, swap, data.
>>> I would like /home and other good stuff, say /data, to be on the second
>>> How do I do this / what are the magic google terms?
>>> mount the 2nd disk as /disk2, and create /home and /data and link them to
>>> /home and /data on the 2nd disk?
>>> Normally, one would make an entire partition as /something, like /home.
>>> Here I want multiple /somethings on the second disk.
>>> Are there other good things that should be there too? I presume /etc is
>>> right out, probably /usr too. /var?
>>> Good reference doc appreciated - "linux partitioning" drowns me as a
>>> search term.
>> It a fairly subtle task and might not be searchable.
>> On a new install you would choose an advanced disk set up and set up
>> partitions and mount points manually.
>> If you are retro-fitting a disk then you could do a short set of simple
>> commands (assuming /dev/sdb)
>> 1. fdisk /dev/sdb # Create partitions, if they don't already exist. Keep
>> in mind any data on the disk will be lost.
>> 2. mke2fs -j /dev/sdb1; mke2fs -j /dev/sdb2 # Create file systems.
>> 3. Edit /etc/fstab to add the new file systems, mount then on the proper
>> destinations (i.e. /home and /data)
>> 4. mount /home; mount /data # Mount the file systems. This command will
>> ensure that you fstab entries are correct.
>> A side task might be to temporarily mount the file systems (mkdir -p
>> /mnt/tmp; mount /dev/sdb1 /mnt/tmp) and move over the data from the existing
>> folder (mv /home/* /mnt/tmp). Then umount and mount on the right mount point
>> (umount /mnt/tmp; mount /home)
>> You might also consider using LVM instead of raw partitions. LVM allows
>> you to expand file systems easily and add disks as needed. This is a little
>> more complicated:
>> 1. fdisk /dev/sdb # create one partition
>> 2. pvcreate /dev/sdb1 # Initialize the partition as a LVM Physical Volume
>> 3. vgcreate MyData /dev/sdb1 # Create the Volume Group named MyData
>> 4. lvcreate -L 20G -n home MyData # Create a 20GB volume group named
>> 5. lvcreate -L 60G -n data MyData #Create a 60GB volume named "data"
>> 6. mke2fs -j /dev/MyData/home; mke2fs -j /dev/MyData/data # Create file
>> systems on the LVs
>> 7. Edit /etc/fstab and add the file systems.
>> 8. mount /home; mount /data # Mount the file systems.
>> When creating LVs you might want to consider leaving unallocated space. In
>> other words don't assign all the disk space to LVs. Then as you use the file
>> systems you will see where you need more space and you can re-allocate then.
>> It's easy to add disk to an LV, it's harder to take it away.
>> John Van Ostrand
>> Net Direct Inc.
>> CTO, co-CEO
>> 564 Weber St. N. Unit 12
>> Waterloo, ON N2L 5C6
>> john at netdirect.ca
>> Ph: 866-883-1172
>> Linux Solutions / IBM Hardware
>> Fx: 519-883-8533
>> kwlug-disc_kwlug.org mailing list
>> kwlug-disc_kwlug.org at kwlug.org
> kwlug-disc_kwlug.org mailing list
> kwlug-disc_kwlug.org at kwlug.org
More information about the kwlug-disc_kwlug.org