[kwlug-disc] Adding (setting up) 2nd disk.

Bob Jonkman bjonkman at sobac.com
Tue Jan 26 20:36:54 EST 2010

I've done the thing below, and it's been steady as a rock.  Did it 
because I had two smallish drives, and didn't want to fragment the free 
space among different partitions.

    # /etc/fstab

    /dev/hda1  /     ext3   defaults,errors=remount-ro  0  1

    /dev/hdb1  /mnt/driveb   ext3  defaults  0  2

    /mnt/driveb/var   /var   none  bind,defaults  0  0

    /mnt/driveb/home  /home  none  bind,defaults  0  0


Bob Jonkman <bjonkman at sobac.com>         http://sobac.com/sobac/
SOBAC Microcomputer Services              Voice: +1-519-669-0388
6 James Street, Elmira ON  Canada  N3B 1L5  Cel: +1-519-635-9413
Software   ---   Office & Business Automation   ---   Consulting

unsolicited 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 disk.
>>> 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 
>> "home"
>> 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
>> map
>> Waterloo, ON N2L 5C6
>> john at netdirect.ca
>> Ph: 866-883-1172
>> ext.5102
>> Linux Solutions / IBM Hardware
>> Fx: 519-883-8533
>> _______________________________________________
>> kwlug-disc_kwlug.org mailing list
>> kwlug-disc_kwlug.org at kwlug.org
>> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org
> _______________________________________________
> kwlug-disc_kwlug.org mailing list
> kwlug-disc_kwlug.org at kwlug.org
> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org

More information about the kwlug-disc mailing list