Multiplle hard disks
I have few hard disks installed on Linux machine ( Fedora 2 )
The main idea is to run Samba server and to give to LAN ( Windows desktops ) access to it. What is the best way to organise it that the multiple disks would look for the network users like one big directory? I feel it is possible, but my knowledge is too short.:( |
for example if you have two disks do this:
Code:
mkdir /mnt/share/disk1 |
You can use the Logical Volume manager to create a volume group that spans multiple physical devices. Then you create one or more logical volumes in the volume group and create filesystems on the logical volumes.
Confused? Let's say you have two physical hard drives hd1 and hd2. Through the LVM software you create a single volume group and assign both drives to it. Now that volume group has the capicity of both disks. To create filesystems with all the disk space, you create a local volume and tell it how much of the vg's disk space you want to allocate to it. Finally you create you reiserfs or ext3 or whatever filesystem on the lv and mount it. Walla... you have one huge filesystem. Point your windows users to it via your samba conifg and you are done. Formally the Sistina HOW-TO doc, very good: http://www.tldp.org/HOWTO/LVM-HOWTO/ I use the LVM on pretty much every machine that I put Linux on. It allows me to grow and shrink filesystems very easily. |
Thank you for prompt reaction.
I was already so far that tried to vgcreate big_share /dev/hda3 /dev/hdb1 but get : No physical volume label read from /dev/hda3 /dev/hda3 not identified as an existing physical volume Unable to add physical volume '/dev/hda3' to volume group 'big_share'. Does it mean that I can't use partition but only the hole disk? |
Yes you can use one or more partitions as well as the whole disk. You need to initialize the disk for the LVM first.
http://www.tldp.org/HOWTO/LVM-HOWTO/initdisks.html Note that my steps below are just a brief summary. You should take a look at the howto while setting it up. |
I read in howto:
DANGEROUS The following commands will destroy the partition table on the disk being operated on. Be very sure it is the correct disk. # dd if=/dev/zero of=/dev/diskname bs=1k count=1 # blockdev --rereadpt /dev/diskname and my hand begin shaking :) Doesn't pvcreate destroy partition table? And data? |
OK,
I did: pvcreate /dev/hda3 No physical volume label read from /dev/hda3 Physical volume "/dev/hda3" successfully created then: pvcreate /dev/hdb1 No physical volume label read from /dev/hdb1 Physical volume "/dev/hdb1" successfully created But still: vgcreate big_share /dev/hda3 /dev/hdb1 No physical volume label read from /dev/hda3 /dev/hda3 not identified as an existing physical volume Unable to add physical volume '/dev/hda3' to volume group 'big_share'. |
Did you get an error doing the pvcreate? If not then don't run the dd.
Yes the pvcreate will destroy data in the partiition you specify. If you speifcy a drive it _will_ modify the partitiion table and destroy the data. You will have to mark your partitions that you want to use with the LVM as LVM partition through your partition manager like cfdisk. Type 8E I was under the impression that these disks were not used and clean. If you in fact to have data on the disks, then it is still possible to move the entire set to the LVM parts at a time. You would need at least 50% free disk space. |
Label the partitions as LVM in cfdisk and save the partition table. reboot.
|
Too late :(
Now I have problems. I can still boot system. And there is some .iso file created which is 112 Gb of size and hopefully keeps my data. The question is now how to get it back? |
It is 112 Mb
|
Uh-oh. Not good.
Explain to me what you had before on these paritions, file system types, mount points, etc... Also what exactly you did to these paritions. Was it the pvcreate or cfdisk that screwed it up. Do you get any boot errors? |
I'm now away from the location of the computer.
there were 2 hardisks disk A: hda1 - system hda2 - swap hda3 - storage and disk B: hdb1 - storage hda3 is mounted to / hdb1 was mounted as I can remember to /home/product/ I did only pvcreate and vgcreate ( see my previous post ) , no cfdisk After a while system hanged, after reboot gave error message and I could login as root when prompt was something like Restore 28# |
If hda1 is system it is likely mounted on /
Was hda3 on a mount like /storage? Unless hda3 contained something important like /usr or /var I don't see why your system has difficulty booting. When you are at the machine post the output of df -k and post contents of /etc/fstab. How are your backups? I've never run pvcreate on a live filesystem or even a partition or disk that I cared out the data on. It's likely that your data is gone or not easily retreived. If you have good backups, great, setup the LVM as you want and restore the data. If not, well... There is always the lvm resource page and mailling list: http://sources.redhat.com/lvm2/ |
df -k output:
/dev/hda3 .... etc/fstab something like that ( have to type ): Label=/ / ext3 defaults 11 none /dev/pts devpts gid=5,mode=620 00 none /dev/shm tmfs defaults 00 Label=/home/second /home/product 2 0 none /proc proc ext3 defaults 00 none /sys sysfs defaults 00 /dev/hda2 swap default 00 /dev/cdrom /mnt/cdrom/ .... Of course no backup, otherwise I wouldn't worry. |
All times are GMT -5. The time now is 05:43 AM. |