Creating Filesystem using DD for LVM


 
Thread Tools Search this Thread
Operating Systems Linux Creating Filesystem using DD for LVM
# 1  
Old 01-25-2011
Creating Filesystem using DD for LVM

I created a new filesystem using dd and mounted:

I have a filesystem /FAW with 1Terra space
Code:
/dev/sdb1            1151331444  24742604 1068104612   3% /FAW



Steps I followed to create a new filesystem
Code:
# dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G
# mke2fs disk2.img 

# mount -o loop disk2.img /FAW/xen_vm/

Now df -k output is :
==============

Code:
/FAW/vms/linux_vm/disk2.img
                     516061624     71448 489775776   1% /FAW/xen_vm


I want to be able to add the above disk2.img partition to pvcreate lvm which does not recognize.

Can someone tell me how i should convert it to filetype recognised by LVM.
# 2  
Old 01-25-2011
LVM, by default, ignores any "devices" outside of /dev, or anything with a filesystem on it. So the recommended (by me) way would be to run
Code:
# dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=0 seek=500G
# losetup -sf /FAW/vms/linux_vm/disk2.img
# pvcreate /dev/loop<x>

where x is the number reported by losetup. Or, if there's no other data on it, use the whole of /dev/sdb1 for LVM.
# 3  
Old 01-25-2011
Hi Pludi,

Code:
# losetup -sf /FAW/vms/linux_vm/disk2.img
losetup: invalid option -- s

So i did:
Code:
losetup -f                                                # find unused
# losetup -f /FAW/vms/linux_vm/disk2.img

Still does not show up
Code:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             9.7G  5.7G  3.5G  63% /
/dev/sda1             190M   45M  136M  25% /boot
/dev/sdb1             1.1T   24G 1019G   3% /FAW

/FAW/vms/linux_vm/disk2.img
                      493G   70M  468G   1% /FAW/xen_vm
# losetup -a
/dev/loop0: [fd01]:49160 (/FAW/vms/linux_vm/disk2.img)
/dev/loop2: [fd01]:49160 (disk2.img)


is there a way to make is use /dev/sdc1 ?

Last edited by pludi; 01-25-2011 at 09:04 AM..
# 4  
Old 01-25-2011
Of course it won't show up in df after losetup, since df shows only mounted filesystems. Remove the loopback you've just created, unmount /FAW/xen_vm, then set up the loopback device again and run pvcreate on it. After this it will still not show up in df, but you can create a volume group and logical volumes on it, which you can then put a filesystem on.
# 5  
Old 01-25-2011
Thanks a lot,

I think i made a mistake here.

After creating the disk
dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G

I created a file system:

mke2fs disk2.img

After creating physical,logical volumes i again tried to create filesystem and it hanged.

mkfs.ext3 /dev/xen-vm/xen_prov
# 6  
Old 01-25-2011
Wait wait wait. The correct order is
  1. Create an image file
  2. Create a loopback device for the file
  3. Run pvcreate on the loopback device
  4. Run vgcreate on the "physical" volume
  5. Run lvcreate on the volume group
  6. Create a filesystem on the logical volume
  7. Mount the logical volume
Why did you create a filesystem on the image file? What were your exact steps and what does your system look like now?
# 7  
Old 01-27-2011
Sorry I am back to work just now, yesterday was a holiday for us.

I have not yet got the machine back to test it.

Ok here I am listing down what you said,

Code:
1) Create an image file
===============
#dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G

Code:
2)Create a loopback device for the file
===========================
#losetup -f /FAW/vms/linux_vm/disk2.img


# losetup -a
/dev/loop0: [fd01]:49160 (/FAW/vms/linux_vm/disk2.img)

Code:
3) Run pvcreate on the loopback device
===============================
# pvcreate /dev/loop0  (initialise disk created)
  Physical volume "/dev/loop0" successfully created

Code:
4)Run vgcreate on the "physical" volume
===============================
#vgcreate xen-vm /dev/loop0
Volume group "xen-vm" successfully created

Code:
5) Run lvcreate on the volume group
============================
#lvcreate -L450G -nxen_prov xen-vm

Logical volume "xen_prov" created

Code:
6)Create a filesystem on the logical volume
===================================
#mkfs.ext3 /dev/xen-vm/xen_prov
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58982400 inodes, 117964800 blocks
5898240 blocks (5.00%) reserved for the super user
First data block=0
......................
.........................................

Code:
7) Mount the logical volume
========================
mount /dev/xen-vm/xen_prov /FAW/xen_vm

Let us know if this is rite, I have not yet executed the 7th point since I have not go the system back yet.

Last edited by sriram003; 01-27-2011 at 06:25 AM.. Reason: correction point 7
This User Gave Thanks to sriram003 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Creating filesystem in LDOMs

Hi, I have a task of creating a UFS filesystem in an LDOM. It is located in a hypervisor (CDOM). The storage has been provisioned to the CDOM. How do I make it reflect to the LDOM, and then from there configure/set up the filesystem in the LDOM? Please help. (1 Reply)
Discussion started by: anaigini45
1 Replies

2. Linux

Creating file systems (LVM v Multipath)

Hi all I have a system running: uname -o GNU/Linux that has already some file systems created: df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_outsystemdb-lv_root 50G 2.7G 45G 6% / tmpfs 28G 72K 28G 1%... (5 Replies)
Discussion started by: fretagi
5 Replies

3. AIX

Process using/creating files in the filesystem

Hello Team, In a application filesystem, there is a process keep creating the log files. Due to that the filesystem keep getting full. Please let me know how to identify the process which is keep writing in the filesystem. fuser -u <FS> will show only the user who using the filesystem.... (3 Replies)
Discussion started by: gowthamakanthan
3 Replies

4. Red Hat

Expand EXT3 filesystem ( No LVM)

hi, In my production server having Enterprise Linux Enterprise Linux Server release 5.5 (Carthage) Red Hat Enterprise Linux Server release 5.5 (Tikanga) we have a filesystem of 197 gb (Type ext 3) Hadisk in which this filesystem reside is sdb is of 217 gb. (NO LVM) Now I want to... (6 Replies)
Discussion started by: salmanraza
6 Replies

5. Linux

Creating /boot partition for LVM VG

Hi, I have a server booted into sysresccd (mini-linux OS) with 1 40 GB disk attached I am trying to create a volume group and restore another server into the new one However, when I try to create a partition for /boot it seems that my VG in LVM is not recognized anymore These are the... (2 Replies)
Discussion started by: galuzan
2 Replies

6. Red Hat

Growing filesystem using LVM

Hi, I have a LUN presented to a Linux system and would like to ask if someone can advise if the logical volume /dev/mapper/VGOra-LVOra 12G 11G 659M 95% /usr/app/oracle can be extended. Is there any free space to allocate.... The LUN (25G) has been configured as follows: LUN - ROOT...... (4 Replies)
Discussion started by: jamba1
4 Replies

7. Red Hat

Creating filesystem on new LUN

I'm new to linux and need information on how do I create a filesytem on a dedicated on LUN for RHEL 4 and 5? I want the filesystem to be a ext3 ---------- Post updated at 10:00 AM ---------- Previous update was at 08:56 AM ---------- Found the answer. This thread can be closed. (1 Reply)
Discussion started by: soupbone38
1 Replies

8. Filesystems, Disks and Memory

Creating filesystem of 2MB size

Hi all, I would like to ask on how to create 2MB partition on a Compact Flash card. It supposed to be of FAT12 type, and the CF capacity is 4GB. I try to do the partitioning and specify the size as 2MB but the partition editor automatically resize it to 8MB. I know that this is possible and the... (4 Replies)
Discussion started by: archayl
4 Replies

9. Solaris

creating new filesystem

# df -h Filesystem size used avail capacity Mounted on /dev/dsk/c1d0s0 4.5G 4.3G 129M 98% / /devices 0K 0K 0K 0% /devices ctfs 0K 0K 0K 0% /system/contract proc 0K 0K ... (4 Replies)
Discussion started by: seyiisq
4 Replies

10. AIX

Creating a shared filesystem

Hi everybody, Is it possible to create a Shared Filesystem on Network to be accessed from 2 Systems? Both systems are AIX but with different versions. One of these systems is AIX 4.3 & the other is AIX 5.2. Thanks in advanced (8 Replies)
Discussion started by: aldowsary
8 Replies
Login or Register to Ask a Question