LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   adding new drive (https://www.linuxquestions.org/questions/linux-newbie-8/adding-new-drive-664302/)

Junior_DBA 08-21-2008 06:03 AM

adding new drive
 
Hi all. I added a new drive to my system /dev/shm and i have a folder /oradata with files in it.

I want this folder to be on the new drive and drive i want to be mounted to the /oradata so i did:

mv /oradata /dev/shm and got error:( permission denied.

What am i doing wrong?

pixellany 08-21-2008 06:20 AM

If you have added a physical drive, you need to do several things (possible commands in parens---check the man pages for each one):
set up one or more partitions (fdisk, cfdisk, gparted, etc.)
format the partition(s) with a file system (mkfs)
mount the partition(s) to your existing filesystem tree (mount, fstab)

the mv (move) command is used to move files once all the above is done.

I'm puzzled about the designation "/dev/shm"---is that what you get if you run "fdisk -l"?

Junior_DBA 08-21-2008 06:27 AM

Thanks! We did all what you said and now it works fine.

Yes, /dev/shm i got from fdisk -l :) i thought that it was my new drive :))

pixellany 08-21-2008 06:32 AM

memo to <<insert name of your favorite deity>>:

Please update all human life forms to behave more like Junior_DBA. Actually answering queries and even saying "thank you"---what a novel concept.......

matthewg42 08-21-2008 06:33 AM

/dev/shm is a device which is used for shard memory access. If you have added a hard disk to your system, I think you have mis-identified the device for the drive.

Looking at the output of dmesg might be able to provide you with the proper device id for your disk. Typically this will be /dev/hd? or /dev/sd? for consumer disks.

The device is not something which you deal with directly - you should not copy files to /dev/sda for example.

Instead, you should partition the disk, format the partitions, and then mount them at some point in the filesystem. Partitions have devices in /dev/, with a number appended to the base device. For example, /dev/sdb2 is the second (primary type) partition on the drive /dev/sdb.

For example, let's say the new disk is /dev/sdb. The procedure you would be looking at would be something like this:
  1. NOTE: this procedure is not the right one if your system uses LVM - only for "traditional" filesystems.
  2. Backup, and make sure you have a working restore procedure.
  3. Shut down oracle and whatever else might be using files in /oradata/
  4. Use fdisk or cfdisk or gparted or some similar tool to create one or more partitions on the disk. Lets take the simplest option and create one primary partition of type ext3 - that partition will get the device node /dev/sda1
  5. format the new partition with:
    Code:

    mkfs.ext3 /dev/sdb1
  6. temporarily mount the new partition on /mnt. /mnt is used for mounting devices for a short time. As root:
    Code:

    mount /dev/sdb1 /mnt
  7. Copy the files to the new disk, mounted on /mnt.
    Code:

    cp -vdpr /oradata/* /mnt/
  8. Create a file to act as a flag to show you are using the new disk (see later step)
    Code:

    touch /mnt/is_new_disk
  9. un-mount the disk from /mnt:
    Code:

    umount /mnt
  10. Edit the /etc/fstab adding a line so the new disk will be mounted at boot. Add a line like this:
    Code:

    /dev/sdb1 /oradata ext3 errors=remount-ro 0 2
  11. mount the disk, this time in the proper location. Since you have added a line in /etc/fstab, you should be able to do it like this:
    Code:

    mount /oradata
  12. Check that /oradata now contains the data from the disk. Since you made the file "is_new_disk" a few steps ago, you should be able to see that in /oradata now.
After this procedure, you will have two copies of the /oradata files - one on the new disk which is accessible in the /oradata directory. The old copy of the files will still exists on whatever device they used to (I assume it is the root device, else the procedure above will not work properly). These old files will not be visible until you un-mount the new disk. I recommend leaving them there until you have done a careful test of the new setup. Only then should you consider deleting them. The procedure to delete the old files is like this:
  1. un-mount the new disk:
    Code:

    umount /oradata
  2. Verify that you are looking at the old files (the "is_new_disk" file should have disappeared).
  3. Do the deletion. Be totally sure what is going on before doing this command:
    Code:

    rm -rf /oradata/*
  4. re-mount the new disk:
    Code:

    mount /oradata
  5. All your files are OK, right? If not, get that backup out.


All times are GMT -5. The time now is 12:54 AM.