Solved

New SCSI drive

Posted on 2004-09-13
21
282 Views
Last Modified: 2013-12-15
on my ibm tower server i have 6 bays. i already install fedora core1 on the first scsi drive. i put the first scsi drive at the lowest part of the bays. today i just add new scsi drive which is same brand and same saiz like current. but fc1 seems didnt show anything whill booting up. but i manage to see the new hdd. I want to make this new scsi drive as a backup file. where there is no partition like current drive, it's like in windows where i just format it and it i can't see any folder, then i can manage to create a folder or backup file. How do I format the new drive and can be visible to me on fc1?

here my cat /etc/fstab

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

here is my /etc/mtab

/dev/sda2 / ext3 rw 0 0
none /proc proc rw 0 0
none /dev/pts devpts rw,gid=5,mode=620 0 0
usbdevfs /proc/bus/usb usbdevfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
none /dev/shm tmpfs rw 0 0

here is my cat /proc/mounts

rootfs / rootfs rw 0 0
/dev/root / ext3 rw 0 0
/proc /proc proc rw 0 0
/dev/pts /dev/pts devpts rw 0 0
usbdevfs /proc/bus/usb usbdevfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
none /dev/shm tmpfs rw 0 0

previously i said i can see my new drive when i type this command fdisk -l
and here is the result

Disk /dev/sda: 73.4 GB, 73407488000 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 8696 69746197+ 83 Linux
/dev/sda3 8697 8924 1831410 82 Linux swap

Disk /dev/sdb: 73.4 GB, 73407488000 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System


What I planned to do after format the new drive is to move the /var and /home folder into the new drive....

0
Comment
Question by:ftpfreak
  • 9
  • 7
  • 5
21 Comments
 
LVL 19

Expert Comment

by:jools
ID: 12043179
Hi,

If I understand your question correctly, you need to partition and format it like any other drive. I've added the following as an example.

     # fdisk /dev/sdb

Create a new partition 5GB in size.
     Command (m for help): n
     First cylinder (5-1292, default 5): <ENTER>
     Using default value 5
     Last cylinder or +size or +sizeM or +sizeK (5-1292, default 1292):+5000M

Repeat the create new partition for each one you want to create.

Write the partition to disk by press w and <ENTER>

Display the parition information
     # fdisk -l /dev/sdb

Newfs the partitions you created.
     # mkfs -t ext3 /dev/sdb1

Create mount points and mount the partitions for the temporary move. Ideally you may want to be in single user for this.
     # mkdir /newvar /newhome
     # mount -F ext3 /dev/sdb1 /newvar
     # mount -F ext3 /dev/sdb2 /newhome

Copy the data...
     # cd /var
     # find . -mount -print | cpio -puvdm /newvar
     # cd /home
     # find . -mount -print | cpio -puvdm /newhome

Modify fstab, you can use Labels for the file systems if you wish, check out e2label for more information.
     # vi /etc/fstab
     /dev/sdb1 /var ext3 defaults 1 2
     /dev/sdb2 /var/ext3 defaults 1 2
     :wq!

From the top of my head I think thats it but don't blame my if it goes t1ts up. You should be able to boot single user if something is out of place. Post back here with more information if you need to.

Regards

Jools
0
 

Author Comment

by:ftpfreak
ID: 12050607
how about if i just want to create i single partition on new drive?...

i just like windows system where i got 2 drive....first drive is install with the OS, application and the second drive is just to store the My DOcument....

can i change the 5GB to 73.4GB?
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12051378
ftpfreak


There is no problem about having whole hard drive to have just one partition. You can create primary partition for 73.4GB. In case that you have just one primary partition its name will by /dev/sdb1 . So do not create logical partiton because there in no point to do that then just use same mountpoints as are shown in jools previous comment.

Also instead of fdisk you can use cfdisk which it seem to me more user friendly as fdisk but it does same job. Check man page: # man cfdisk and then just create filesystem and edit /etc/fstab like shown in jools previous comment.


If you still want to have partition big 73.4GB just keep in mind that smaller filesystems are more ease to manage and also are better to recover after some damage like big filesystems like in your case 73.4GB big partition. But anyway there is nothing wrong about partition big 73.4GB.

Luxana



0
 

Author Comment

by:ftpfreak
ID: 12051461
thanks...but will the Jools sugguestion to me on how to create partition will works?...because i worried if something went wrong
0
 

Author Comment

by:ftpfreak
ID: 12051485
Luxana....

so what is your suggestion?

i just want to change and copy current /home and /var directories to the new drive...

so for you all experience....what is best directory for me to move to the new drive other than home and var?

thanks
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12051778
Ok...

i just want to change and copy current /home and /var directories to the new drive

with word change you think that you want use this new partition for /var and for /home so you will no longer use current /var and /home folders.

In that case you can do :

1)
create two partitions on new hard drive for /var and /home with cfdisk or fdisk let's say :
primary partition 50GB for /home
/dev/sda1
primary partition rest of space for /var
/dev/sda2
2)
then create filesystem :

# mkfs -t ext3 /dev/sdb1
# mkfs -t ext3 /dev/sdb2
3)
mount tempor. new partitons to /mnt/dir1 /mnt/dir2

# mount -t ext3 /dev/sda1 /mnt/dir1
# mount -t ext3 /dev/sda2 /mnt/dir2

4)
this task  do in single user mode
copy data:
# find /home -mount -print | cpio -puvdm /mnt/dir1
# find /var -mount -print | cpio -puvdm /mnt/dir2

5)
edit /etc/fstab

/dev/sda1       /home           ext3    defaults       0       2
/dev/sda2       /var           ext3    defaults       0      0

-----------

your data on current /home and /var will stay because you will mount new folders /var/ and /home on top of the currents directories. When everitgs will work finne just umount /var and /home directories and remover old data to make more free space do that also in single mode.

if you are unsure about somethnig just ask.

let us know how you doing...!

Luxana





0
 
LVL 19

Expert Comment

by:jools
ID: 12052106
ftpfreak
You don't have to use the 5GB partition size I specified, you can change this to suit your own needs.

There is no problem in using just one large partition, in face the defaults for creating the partition in fdisk will probably default to allow you to do that anyway. Don't forget though that you originally wanted to have 2 partitions copied to the new disk. Whilst this is fine the disk layout and fstab could get a little messy. It it were me I'd just create the two or three partitions and be done with it.

Perhaps if you tell us what you're actually wanting then we could suggest some specific sizes, I wouldn't create large /home and /var partitions without knowing what I wanted to achieve.

Luxana
I agree that cfdisk is easier to use but it has been depricated since about RH 7.1 and although you may be able to get a copy with all the other dependencies fdisk easily does the job. There may be an option to use sfdisk but I've not used it myself.

BTW, who mentioned creating Logical Partitions....not that it actually matters what is used?


Jools
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12052228
BTW, who mentioned creating Logical Partitions....not that it actually matters what is used?


Nobody metioned to create logical partitions and thats way I metioned that because ftpfreak will have an option before he create new partitions so I jast wanted him to choose primary:-)

0
 

Author Comment

by:ftpfreak
ID: 12072507
hmm...what are the best for server? i mean for the secondary scsi hdd
0
 
LVL 19

Expert Comment

by:jools
ID: 12072586
post a df-k here and we may be able to suggest something...

Also, if you can include some details of what you want to get out of the disk layout that would help too.

J
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 10

Expert Comment

by:Luxana
ID: 12072662
ftpfreak,

Everything depends on your needs to by honest with you I'm now a bit confused about what you are trying to do and about the reason as well. As jools said please give as some more informations about your server and what are you using your server for. Also try paste her command

# fdisk -l
with sort description about the output.

Luxana
0
 

Author Comment

by:ftpfreak
ID: 12081458
[root@domain root]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2             68650036   1753620  63409108   3% /
/dev/sda1               101086      8708     87159  10% /boot
none                    516120         0    516120   0% /dev/shm
[root@domain root]#

[root@domain root]# fdisk -l

Disk /dev/sda: 73.4 GB, 73407488000 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1   *         1        13    104391   83  Linux
/dev/sda2            14      8696  69746197+  83  Linux
/dev/sda3          8697      8924   1831410   82  Linux swap

Disk /dev/sdb: 73.4 GB, 73407488000 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
[root@domain root]#
0
 

Author Comment

by:ftpfreak
ID: 12081468
luxana, i just want to create a secondary drive formated and viewable to my fedora....then i want to move the /var and /home directory to the new drive...that mean for example, if new user is add in to my fedora, it wont go to /home at first drive, so it go to second drive
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12081590
ok so then just do what I wrote above. Just to sum it up create two diferent partitons on /dev/sdb one /var=/dev/sdb1 and another /home=/dev/sdb2 copy the all files and edit /etc/fstab to mount your new partitons on top of the current /home and /var directories. Do that when your clients do not need to go to their home directories and are not loged in ,the best way is single mod escpecialy /var directory. Remeber that if you mount your new home direcotry on top of current one you will not see your old files unless you unmount the new /home directory.

LUXANA

0
 
LVL 10

Expert Comment

by:Luxana
ID: 12081608
and one more think you do not need to do both partions at once try first /home edit /etc/fstab I see if it works then add one more. Also is good to do testing first if you are not sure about what you are doing. Lets say create partions and map in in /etc/fstab to /test folder wich you will create first...

try and let us know how you doing:)))
0
 
LVL 19

Accepted Solution

by:
jools earned 50 total points
ID: 12082249
ftpfreak:

Do you really want the whole disk used up for just /var and /home, it seems like a huge waste of space, I'd perhaps suggest a 10GB partition for /var and a 20GB partition for /home (should be more than enough) you can then create a spare partition for other data using the rest of the disk and perhaps mount this as "work" or "data" or even "stuff" . As you have not indicated what the system is to be used for it is difficult to suggest viable alternatives.

However, the original posting will do what you want, in summary the process is;
o Create (at least) 2 partitions on sdb of a size you want. NOTE THAT THE FIGURES BELOW ARE MADE UP AND WILL NOT RELATE TO YOUR DISK OUTPUT!

     # fdisk /dev/sdb
     Command (m for help): n <ENTER>
     Command action
        e   extended
        p   primary partition (1-4)
     p <ENTER>
     Partition number (1-4): 1 <ENTER>
     First cylinder (1-2586, default 1): <ENTER>
     Using default value 1
     Last cylinder or +size or +sizeM or +sizeK (1-2586, default 2586): +10G <ENTER>

     Command (m for help): p <ENTER>

     Disk /dev/sdb: 240 heads, 63 sectors, 2586 cylinders
     Units = cylinders of 15120 * 512 bytes

        Device Boot    Start       End    Blocks   Id  System
     /dev/sdb1            1       1536   10243800  83  Linux

     Command (m for help): n <ENTER>
     Command action
        e   extended
        p   primary partition (1-4)
     p <ENTER>
     Partition number (1-4): 2 <ENTER>
     First cylinder (1537-2586, default 1537): <ENTER>
     Using default value 1
     Last cylinder or +size or +sizeM or +sizeK (1-2586, default 2586): +20G <ENTER>

     Command (m for help): p <ENTER>

     Disk /dev/sdb: 240 heads, 63 sectors, 2586 cylinders
     Units = cylinders of 15120 * 512 bytes

        Device Boot    Start       End    Blocks   Id  System
     /dev/sdb1            1       1536   10243800  83  Linux
     /dev/sdb2            1       1024537   20487200  83  Linux

     Command (m for help): w <ENTER>

    NOTE THAT YOU WILL HAVE SOME SPARE CAPACITY ON THE DISK SO YOU CAN EITHER:
       A/ ADD ANOTHER PARTITION TO USE THE REST OF THE DISK SPACE FOLLOWING THE ABOVE EXAMPLE!
       B/ CHANGE THE PARTITION SIZES SHOWN ABOVE TO USE THE WHOLE DISK.

o Newfs the partitions
     # mkfs -t ext3 /dev/sdb1
     # mkfs -t ext3 /dev/sdb2

o Mount the partitions
    # mkdir /newvar /newhome
    # mount -t ext3 /dev/sdb1 /newvar
    # mount -t ext3 /dev/sdb2 /newhome

o Copy the data to the new partions.
    # cd /var
    # find . -mount -print | cpio -puvdm /newvar
    # cd /home
    # find . -mount -print | cpio -puvdm /newhome

o Now modify /etc/fstab using your favourite editor.
    # vi /etc/fstab
     /dev/sdb1 /var ext3 defaults 1 2
     /dev/sdb2 /home ext3 defaults 1 2
     :wq!

o You *may* need to check the permissions for the mount points to match your existing /var and /home

o Reboot the system

IF THIS DOES NOT WORK THEN YOU SHOULD BE ABLE TO SORT IT OUT FROM SINGLE USER MODE.

Hope this helps.

J


0
 

Author Comment

by:ftpfreak
ID: 12082822
i will follow which is more efficient...thanks and i will try it out
0
 

Author Comment

by:ftpfreak
ID: 12239815
i succesfull add new drive...i do a parition for /var, /usr, and /home to the second drive..this is for server purposes. i planned to do if the system is corrupt..so i just need to install on the first drive and leave it the second drive...is the folder that i choose is correct folder? /var /usr and /home..thanks
0
 
LVL 19

Expert Comment

by:jools
ID: 12247950
Can you clarify your question please, give examples of what you want to do if it helps.

J
0
 

Author Comment

by:ftpfreak
ID: 12283984
no i mean...i succesfully follow the method, but for most server administrator, which directory in linux should be saparate?
0
 
LVL 10

Expert Comment

by:Luxana
ID: 12284063
> but for most server administrator, which directory in linux should be saparate?

/var
/home
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now