Linux Debian 2 hard drives question.
Hello i have one server with 2 hard drives and i want to know how to browse each one of them at a time,i mean how i use cd /home/blabla something like that,and switch to the other hard drive.I want to use the first drive for running my gameserver and the second for installing and running only the database of the server.Thank you
|
Hi, it sounds like you need to know how to mount a drive within your filesystem. You can find out how to do this by typing
Code:
$ man mount Code:
$ man fstab In Windows, every physical device appears as a separate entity, as does each partition on devices that have more than one. (Drives A:-Z: ) In Unix-like operating systems, each disk partition is identified by a combination of drive name and partition number. Debain, like most GNU/Linux systems, uses the following scheme: (s,h)d(a-z)(1-9). Looks confusing, but it's pretty simple: Your primary hard drive will be called sda if it's a serial (ie, SATA) device or hda if it's an older IDE device. Devices like optical drives and USB disks are named similarly, but not exactly the same. After the disk identifier, each volume name will be appended with the partition number in question. My own desktop machine has two drives, hda and sda. I have partitions hda1, hda2, hda5-hda9 and sda1, sda2 and sda5-sda7. The numbers should correspond to the native partition numbers as Debian sees them. Note that your partitions may not be numbered contiguously, depending on how your drives are partitioned. The Gnome Disks utility will give you a simple overview of each drive layout; KDE and other window managers have similar utilities. The program Gparted will give you a more detailed view, but be careful with it. On the other hand, it can be just as informative and easier to use the terminal: Code:
# fdisk -l Note that there is a different scheme called UUID, which uses long hexadecimal numbers to identify each volume. I don't believe Debian stable will use UUIDs out of the box, but recent Ubuntu versions can use either scheme. Just something to be aware of. Based on the information you gave, I suspect your layout will look something like this: sda, which is probably subdivided into multiple partitions; and sdb, which might be one large partition, or might contain multiple partitions as well. Now that you know how to identify your disk partitions, you need to understand how the filesystem sees them. Unlike the discrete volumes found in Windows, Unix-like OSes organize every volume into one big filesystem. For example, your sda1 partition probably holds your root (/) filesystem, sda2 might hold /var, sda3 might hold /usr and sdb1 might hold /home. When you look at the file hierarchy, the fact that different directories reside on different volumes is hidden from you. It may be a headache now, but it will become very convenient as you become familiar with it. I'm going to assume you understand how to use the mount command with a basic level of expertise. mount assigns each partition on your disks to a directory in the filesystem, whereas the fstab file tells the kernel where to look for each filesystem automatically so you will only need to use the mount command rarely. Debian organizes all of its volumes as files under /dev, but you can't cd or cp directly into them -- they will appear as special files rather than directories. Your hard drive partitions will be known as /dev/sda1-/dev/sdax and /dev/sdb1-/dev/sdbx. All of the filesystems that are essential for system operation should already be defined in fstab. What you need to do now is a) create a diretory and an fstab entry for any partitions on sda that you want access to, then b) create directories and fstab entries for any partitions on sdb you want access to. This magical file resides at /etc/fstab. You must edit it as root, so use the command Code:
# edit /etc/fstab Code:
# /etc/fstab: static file system information. As a practical matter, you will probably want to mount all of your data partitions under /home. If this is a single-user machine, create directories such as /home/username/music, /home/username/www and /home/username/video. If it is a multiple-user machine, create the directories you want directly under /home, then make sure each directory has the proper permissions for each authorized user to access it. Remember that you are assigning entire filesystems to each of these directories. It is possible to assign sub-sections of a filesystem to a given directory, but the syntax is a bit different. Now that you have entered values for each of the filesystems you want to mount automatically, you will need to save /etc/fstab and then reload it. To relaod fstab, you can either reboot or use the following command: Code:
# mount -a |
Thank you very much for your reply,I used fdisk -l command and it gave me this output.Can you tell me please if this guide i found is also good http://linux.justinhartman.com/Insta...ond_hard_drive ,and if it is safe to partition sdb ?because i don't know if it contains anything.And what about the /dev/md0 /dev/md1 /dev/md2 ?wha are these things?And operating system and all things are in sda hard disk ?Because i need sdb emty,to partision it,and format it.Thank you
root:~# fdisk -l Disk /dev/sda: 750.1 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000750e8 Device Boot Start End Blocks Id System /dev/sda1 1 523 4200966 fd Linux raid autodetect /dev/sda2 524 785 2104515 fd Linux raid autodetect /dev/sda3 786 91201 726266520 fd Linux raid autodetect Disk /dev/sdb: 750.1 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000d1d9f Device Boot Start End Blocks Id System /dev/sdb1 1 523 4200966 fd Linux raid autodetect /dev/sdb2 524 785 2104515 fd Linux raid autodetect /dev/sdb3 786 91201 726266520 fd Linux raid autodetect Disk /dev/md0: 4301 MB, 4301717504 bytes 2 heads, 4 sectors/track, 1050224 cylinders Units = cylinders of 8 * 512 = 4096 bytes Disk identifier: 0x00000000 Disk /dev/md0 doesn't contain a valid partition table Disk /dev/md1: 2154 MB, 2154954752 bytes 2 heads, 4 sectors/track, 526112 cylinders Units = cylinders of 8 * 512 = 4096 bytes Disk identifier: 0x00000000 Disk /dev/md1 doesn't contain a valid partition table Disk /dev/md2: 743.6 GB, 743696826368 bytes 2 heads, 4 sectors/track, 181566608 cylinders Units = cylinders of 8 * 512 = 4096 bytes Disk identifier: 0x00000000 Disk /dev/md2 doesn't contain a valid partition table |
The md devices are software RAID. It looks like the partitions on both of your drives are used in some sort of RAID set-up. If you post the output of "cat /proc/mdstat" we should be able to see how exactly the RAID is configured. If it's RAID-1, it might be possible to break up the RAID to use the second hard drive separately, othgerwise it seems likely that you'll need to repartition.
|
If there is nothing useful on either drive, do this:
dd if=/dev/zero of=/dev/sda bs=4k count=10000 dd if=/dev/zero of=/dev/sdb bs=4k count=10000 To zero out the partition tables and boot sectors on the two hard drives. then do: parted parted) select /dev/sda parted) mklabel msdos parted) mkpart p ext3 0 <end> parted) select /dev/sdb parted) mklabel msdos parted) mkpart p ext3 0 <end> parted) q mkfs.ext3 /dev/sda1 mkfs.ext3 /dev/sdb1 Or you can use the linux installer to partition and format the drives. But you shouldn't use an old installation that used RAID. Once you have linux installed: mkdir /mnt/server mount /dev/sdb1 /mnt/server |
Okay i tried the cat /proc/mdstat command as you told me and it gives me this output.
root:~# cat /proc/mdstat Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md2 : active raid1 sda3[0] sdb3[1] 726266432 blocks [2/2] [UU] md1 : active raid1 sda2[0] sdb2[1] 2104448 blocks [2/2] [UU] md0 : active (auto-read-only) raid1 sda1[0] sdb1[1] 4200896 blocks [2/2] [UU] I also tried this command cat /proc/partitions and it gave me this output. root:~# cat /proc/partitions major minor #blocks name 8 0 732574584 sda 8 1 4200966 sda1 8 2 2104515 sda2 8 3 726266520 sda3 8 16 732574584 sdb 8 17 4200966 sdb1 8 18 2104515 sdb2 8 19 726266520 sdb3 9 0 4200896 md0 9 1 2104448 md1 9 2 726266432 md2 unused devices: <none> I also used this command df -h and gave me this output root:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/md2 688G 550M 652G 1% / tmpfs 4.0G 0 4.0G 0% /lib/init/rw udev 10M 772K 9.3M 8% /dev tmpfs 4.0G 0 4.0G 0% /dev/shm /dev/md1 2.0G 79M 1.9G 5% /boot |
Okay i found the solution myself,Thanks for your kind replies Merry Christmas :D
|
All times are GMT -5. The time now is 01:59 PM. |