LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating a file system in Oracle Enterprise Linux (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-file-system-in-oracle-enterprise-linux-4175503332/)

oel 04-29-2014 06:38 AM

Creating a file system in Oracle Enterprise Linux
 
Hello,

I need to create a filesystem in a Oracle Enterprise Linux.
I have a Volumegroup and Logicvolume created.

I“m trying:

# mkfs /dev/sdb
mke2fs 1.43-WIP (20-Jun-2013)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
/dev/sdb is apparently in use by the system; will not make a filesystem here!


Could you lead me in the process?

Regards and thank you in advanced!

wstewart90 04-29-2014 06:49 AM

Firstly the error message tells you that /dev/sdb isn't a partition, it's a whole device and it's usually a second hard drive or a flash drive since /dev/sda is typically going to be the first hard drive. you can still format the whole device if you want but you'll usually want to partition it. The first partition is going to be /dev/sdb1 for example and the second partition will be /dev/sdb2. You'll need to read up on partitions to learn about the limits of primary and extended partitions.

Secondly, you said you have a volume group and a logical volume created. Neither /dev/sdb or /dev/sda are logical volumes. Those are regular block devices. You can view your logical volumes with
Code:

lvdisplay
or
Code:

lvm lvdisplay
and it will show you the full path to the logical volume that you want to format. You can also find it in the /dev/mapper directory.

All of this only applies if you actually did create an lvm properly.

http://www.thegeekstuff.com/2010/08/how-to-create-lvm/

oel 04-29-2014 07:01 AM

Hi wstewart90,

I started with your link...

# sudo pvcreate /dev/sdb
Device /dev/sdb not found (or ignored by filtering).
# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1

What diference exists between /dev/sdb and /dev/sdb1?

Regards

wstewart90 04-29-2014 07:09 AM

/dev/sdb is the entire block device(an entire hard drive for instance). /dev/sdb1 is a partition on that hard drive. you can have multiple partions on /dev/sdb that will all be numbered (e.g., sdb1, sdb2, sdb3 etc...)

http://www.pcworld.com/article/18594...ard_drive.html


partitioning a hard drive ^^^

michaelk 04-29-2014 07:34 AM

There is a GUI tool called system-config-lvm that might be easier for you to understand then using command line utilities.
Do you want to extend your existing VG and LV?

You might want to look at this URL which links to the Redhat LVM guide.
http://www.oracle-base.com/articles/...management.php

oel 04-29-2014 08:56 AM

Hi,
after the first instructions of the link, I have this result...

# pvcreate /dev/sdb1
Can't open /dev/sdb1 exclusively. Mounted filesystem?

I“ve tryed too:

#pvcreate /dev/sdb
Can't open /dev/sdb exclusively. Mounted filesystem?
#pvremove /dev/sdb
No physical volume label read from /dev/sdb
Physical Volume /dev/sdb not found


Here I post the first instruction:

Thank you in advanced!


# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): c
DOS Compatibility flag is not set

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): n
Command action
e extended
p primary partition (1-4)
1
Invalid partition number for type `1'
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
Partition 1 is already defined. Delete it before re-adding it.

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): d
Selected partition 1

Command (m for help):
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +20G
Value out of range.
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +19G

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First sector (39847936-41943039, default 39847936):
Using default value 39847936
Last sector, +sectors or +size{K,M,G} (39847936-41943039, default 41943039):
Using default value 41943039

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002f74e

Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM

Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x34cf36d2

Device Boot Start End Blocks Id System
/dev/sdb1 1 2481 19922944 8e Linux LVM
Partition 1 does not end on cylinder boundary.
/dev/sdb2 2481 2611 1047552 8e Linux LVM
Partition 2 does not end on cylinder boundary.

Disk /dev/mapper/vg_sav500760072-lv_root: 16.8 GB, 16785604608 bytes
255 heads, 63 sectors/track, 2040 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_sav500760072-lv_swap: 4160 MB, 4160749568 bytes
255 heads, 63 sectors/track, 505 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_oracle-oraclelv: 20.4 GB, 20401094656 bytes
255 heads, 63 sectors/track, 2480 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

# pvcreate /dev/sdb1
Can't open /dev/sdb1 exclusively. Mounted filesystem?
#

michaelk 04-29-2014 09:58 AM

Post the output of the mount command (without any options)

oel 04-29-2014 10:48 AM

Hi Michael, finally I could create and mount the filesystem...

I follow all the steps in your link and everything ok. The command used was: "mount -t ext4 -o rw /dev/vgoracle/lvol0 /datos11"

Then, problem solved, thank you!!!

But I have a last question... What diference exists between mount the filesystem in /dev/vgoracle/lvol0 or /dev/sdb1?

Regards,
Marķa

michaelk 04-29-2014 10:55 AM

With LVM /dev/sdb1 is the physical device i.e a container for your volume groups and logical volumes. So you would create and mount the filesysem i.e /dev/vgoracle/lvol0.

If you are not using LVM then /dev/sdb1 is a regular partition and you would create a filesystem and mount just /dev/sdb1.

oel 04-29-2014 10:57 AM

Thank you for the explanation! We can close the thread because my problem is now solved.

michaelk 04-29-2014 11:12 AM

You can mark the thread as solved using the thread tools menu at the top of the page.


All times are GMT -5. The time now is 02:07 AM.