xen disk

Her telden.Hayata dair herşey.Kendinizi ifade edin.

Moderatör: Tardigrada

Cevapla
quaint
Genel Yetkili Adayı
Mesajlar: 188
Kayıt: 11 Tem 2009 19:46
İletişim:

xen disk

Mesaj gönderen quaint »

Re: Xen: Modify disk image size after creation?

--------------------------------------------------------------------------------

1. Create a backup
2. Convert the disk image from qcow2 to raw.
qemu-img convert -f qcow2 -O raw diskqcow2.img diskraw.img

3. Create a file containing all zeros.
dd if=/dev/zero of=zeros.img bs=1024 count=1000000 will create create an approximate 1GB file

4. Concatenate your new "disk" to your newly converted raw disk from step 1.
cat zeros.img >> raw.img Remember >> and not >

5. Resize the partition.
6. Resize the filesystem.
quaint
Genel Yetkili Adayı
Mesajlar: 188
Kayıt: 11 Tem 2009 19:46
İletişim:

Re: xen disk

Mesaj gönderen quaint »

Resizing a Xen disk image partitionShell Script (Bash) posted about 3 years ago by christian

1 # Stop & backup
2 xm shutdown sandbox
3 cp -a sandbox/ sandbox.bk
4
5 # Verify MD5 sum
6 md5sum sandbox/disk.img
7 4976347006df34843d29c939b5fc3742 sandbox/disk.img
8 md5sum sandbox.bk/disk.img
9 4976347006df34843d29c939b5fc3742 sandbox.bk/disk.img
10
11 # Create a 5Gb temp file
12 dd if=/dev/zero of=Tempfile bs=1024 count=5000000
13
14 # Append it to the existing image
15 cat Tempfile >> disk.img
16 rm Tempfile
17
18 # Resize the partition
19 resize2fs -f disk.img
20
21 # Check partition & start domU
22 fsck.ext3 disk.img
23 xm create -c sandbox.cfg
quaint
Genel Yetkili Adayı
Mesajlar: 188
Kayıt: 11 Tem 2009 19:46
İletişim:

Re: xen disk

Mesaj gönderen quaint »

Scenario: In the Dom0 (Host) you have a file that you export to the DomU (Guest) and it appears as a hard drive partition and you want to make it larger.

Example- Dom0: /srv/xen/diskimage.img -> DomU: /dev/xvda1



Resize the Disk Image in Dom0


1. Shutdown the DomU

2. Create a backup of the Disk Image using the cp command

3. Add extra space to the diskimage using dd. This will add 1GB to the DomU image. Adjust count= depending on how much you want to add. If you want a sparse file use seek= to define the entire disk size.

dd if=/dev/zero bs=1M count=1024 >> ./diskimage.img

or if you want a sparse file

dd if=/dev/zero bs=1 count=0 seek=1G >> diskimage.img

4. Boot the domU

Your view /proc/partitions your disk should now be larger. You will need to use traditional tools inside the DomU to make the partitions/LVs and filesystems larger as outlined below.



Expanding DomU Partitions

In this example we're using /dev/xvda as the drive name inside the DomU. Due to limitations in the way traditional partitions work this tutorial is only useful for resizing the last partition on the DomU drive.

1. Start the DomU and log in as root

2. Run fdisk /dev/xvda

3. Note the last partitions start cylinder, then delete the last partition and recreate it with the start cylinder being the same as before and the end cylinder being the default (end of disk)

4. Save this and exit fdisk

5. Run partprobe to update the kernels partition table. View /proc/partitions to see if the last partition is now larger. If not, reboot.

5. Resize the filesystem on the partition, for example using xvda2: resize2fs /dev/xvda2



Expanding DomU Logical Volumes

If you configured your DomU to use LVM and your Logical Volume is not big enough you can resize it.

In the DomU we get the Logical Volume name by using the lvdisplay command.


[ root@vs /srv/xen ] lvdisplay
--- Logical volume ---
LV Name /dev/vgsys/lvvirt
VG Name vgsys
LV UUID XMWzWW-oZih-A5uH-91Sa-7l1y-8cqf-18KcNB
LV Write Access read/write
LV Status available
# open 1
LV Size 60.00 GB
Current LE 1920
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2


According to lvdisplay the path to our Logical Volume is /dev/vgsys/lvvirt.


Hot Resizing Logical Volume:

Resizing the Logical Volume is actually very easy, you'll be amazed.

lvresize --size +10G /dev/vgsys/lvvirt

This lvresize command specifies to add 10GB to /dev/vgsys/lvvirt. This will only take a second.



Hot Resizing the filesystem:

resize2fs /dev/mapper/vgsys-lvvirt

That's really it! You can only hot resize if the Filesystem is getting larger. If you need to shrink it then you'll have to take the Volume offline first. Isn't this easier than dealing with partitions that are too small?
quaint
Genel Yetkili Adayı
Mesajlar: 188
Kayıt: 11 Tem 2009 19:46
İletişim:

Re: xen disk

Mesaj gönderen quaint »

Server Yeni CH Ekleme
İlk olarak virtual pc'de
'cd /usr' yazın (') yazılmıcak.!

sonra 'tar zxvf metin2.tar.gz' yazın.

daha sonra 'sh shortcut.sh' yazın.

şimdi tekrar
'cd /usr' yazın.

ardından '777 Metin2 chmod' yazın.

şimdi bu kodu yazınca bişeyler dolması gerekiyor yani ben yanlış anlamdıysam öyle


şimdi sıra filezilla'da

'/usr/metin2/share_data/locale/hongkong/quest' e gelin. Pc'mde sorun olduğu için
bunuda deneyemedim eğer böyle bi dizin yoksa muhtelemen budur;
'/usr/rain/channel/share_data/locale/hongkong/quest' ama üstteki olma ihtimali yüksek.


şimdi burdan 'locale_big5.lua' ve "main_quest_lv1.quest" düzenlememiz gerekiyor.
"() SERVERNAME " arkadaşlar denemediğim için emin değilim diyorum ama bunu yazmamız
gerekiyormuş.
şimdi servere ./stop yazın ardından ./start yazın eğer no commond gibi bi hata gelirse

'/root' yazın virtual pc ye ondan sonra ./stop sonrada ./start yazın.



şimdi pack dosyasındaki root.epk&eix 'i açın ordan serverinfo.py dsyasını editliceksiniz.

benim anladığım kadarı şu olcak örnek verim;

ERVER01_CHANNEL_DICT = {
1:{"key":11"name":"Kanal1 ""ip":"96.0.203.146""tcp_por t":13000"udp_port":11002"sta te":STATE_NONE}
2:{"key":12"name":"Kanal2 ""ip":"96.0.203.146""tcp_por t":13000"udp_port":11002"sta te":STATE_NONE}
3:{"key":13"name":"Kanal3 ""ip":"96.0.203.146""tcp_por t":13000"udp_port":11002"sta te":STATE_NONE}
4:{"key":14"name":"Kanal4 ""ip":"96.0.203.146""tcp_por t":13000"udp_port":11002"sta te":STATE_NONE}

buradaki ch2 yani kanal2'nin ip'sini kendi serverinize göre yazın. port olarak:

1
2
3
4
5
6
7
16000
16099
16001
16002
16003
16004
16061


bunları vermişler burdaki portları portmaptan açıcaksınız. Deneyin olursa bi teşekkür edin.
olmazsa silinsin konu ama olur bence :=) he bide bu yöntemle sadece ch2 değil ch2 yi açtıkdan sonra
ch3-ch4 de açabilirsiniz.
quaint
Genel Yetkili Adayı
Mesajlar: 188
Kayıt: 11 Tem 2009 19:46
İletişim:

Re: xen disk

Mesaj gönderen quaint »

i saw that i jump one step of the solution ... how i cant edit there i go again:

dd if=/dev/zero of=/dev/ad1 bs=512 count=1 #Clear partition table...etc...
glabel label -v hd2 /dev/ad1 #to creates a label called "hd2"
newfs -U /dev/label/hd2
mkdir /hd2 # to creates a mount point
mount /dev/label/hd2 /hd2 #mounting
quaint
Genel Yetkili Adayı
Mesajlar: 188
Kayıt: 11 Tem 2009 19:46
İletişim:

Re: xen disk

Mesaj gönderen quaint »

dd if=/dev/zero of=zeros.img bs=1024 count=1000000
ile oluşturduğumuz imajı
mount imaj /dev/deneme
mkfs.ufs deneme
fsck.ufs deneme
yapıp
cat fbs1.img >> freebsd-8.0p2-i386-xen-domu.img
ile birleştiriyoruz.
Cevapla

“Serbest Kürsü” sayfasına dön