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

Colin Mackay zixiekat at gmail.com
Tue Jan 26 15:28:11 EST 2010


Tue, you mount filesystems, my apologies.  But apparently, you can
mount a folder into another folder as well with "mount --bind /dir1
/dir2"

Found another link to explain it better:
http://aplawrence.com/Linux/mount_bind.html

As "unsolicited" stated (Sorry, can't recall the real name), he does
not want two file systems, just one with a "home" and a "data"
directory.  He then wants "home" to be his /home and "data" to be
/data.

So if he mounts /dev/sda2 into /mnt/drive2 and creates
/mnt/drive2/data and /mnt/drive2/home, he should then be able to use
"mount --bind /mnt/drive2/home /home" and "mount --bind
/mnt/drive2/data /data" to do what he wants.  He now has one partition
(with one file system) that has two directories.

Please, correct me if I am wrong, "unsolicited".



On Tue, Jan 26, 2010 at 3:20 PM, Raul Suarez <rarsa at yahoo.com> wrote:
> I think there is some confusion here:
>
>
> You mount file systems into directories.
> You do not mount partitions.
> You do not mount directories.
>
> i.e.
>
> If you have your second partition with two directories
> /home
> /data
>
> you actually mount the / of that file system into a directory of the primary file system.
>
> Raul Suarez
>
> Technology consultant
> Software, Hardware and Practices
> _________________
> http://rarsa.blogspot.com/
> An eclectic collection of random thoughts
>
>
> --- On Tue, 1/26/10, unsolicited <unsolicited at swiz.ca> wrote:
>
>> From: unsolicited <unsolicited at swiz.ca>
>> Subject: Re: [kwlug-disc] Adding (setting up) 2nd disk.
>> To: "KWLUG discussion" <kwlug-disc at kwlug.org>
>> Received: Tuesday, January 26, 2010, 3:00 PM
>> 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
>>
>
>
>      __________________________________________________________________
> The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
>
> _______________________________________________
> 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_kwlug.org mailing list