Kroko Just another WordPress weblog

June 20, 2011

Enlarge a xen Image (.img) File

Filed under: Linux,Uncategorized — Tags: , , , , — admin @ 7:03 pm

This HOWTO will allow you to increase the size of .img files created with dd. Note that this process changes the on-disk image in place and hence it is highly recommended that you back up the image first. Also, make sure the image is not already mounted or backing a live domain or virtual machine! This process is *not* recommended for decreasing the overall size of an image and would likely cause the image itself to be corrupted if attempted.
Replace image_file and size_in_MB appropriately
# dd if=/dev/zero of=image_file bs=1M conv=notrunc count=1 seek=size_in_MB
# losetup /dev/loop0 image_file
# e2fsck -f /dev/loop0
# resize2fs /dev/loop0
# e2fsck -f /dev/loop0
# losetup -d /dev/loop0

May 30, 2011

smbd unable to connect to cups server

Filed under: Linux,Uncategorized — Tags: , , — admin @ 12:26 am

I have printing disabled (load printers = no, commented the printer share) in Samba but still puts lots of lines like this in the syslog:

May 29 16:31:02 home smbd[9505]: [2011/05/29 16:31:02, 0] printing/print_cups.c:cups_connect(69)
May 29 16:31:02 home smbd[9505]: Unable to connect to CUPS server localhost:631 - Connection refused

After trying many things, this worked for me:

load printers = no #(this alone isn't enough)
show add printer wizard = no
printing = none
printcap name = /dev/null
disable spoolss = yes

March 15, 2011

copy partition with dd

Filed under: Linux — Tags: — admin @ 6:28 pm

HDD or partition backup with dd
full hard disk copy

dd if=/dev/sdx of=/dev/hdy
dd if=/dev/sdx of=/path/to/image
dd if=/dev/sdx | gzip > /path/to/image.gz

sdx could be sda, sdb etc. In the second example gzip is used to compress the image if it is really just a backup.

Restore Backup of hard disk copy

dd if=/path/to/image of=/dev/sdx
gzip -dc /path/to/image.gz | dd of=/dev/sdx

Getting around file size limitations using split
When making images, it’s quite easy to run up against various file size limitations. One way to work around a given file size limitation is to use the split command.

# dd if=/dev/sda1 | gzip -c | split -b 2000m – /mnt/sdc1/backup.img.gz.
This example is using dd to take an image of the first partition on the first harddrive.
The results are passed through to gzip for compression
The -c option switch is used to output the result to stdout.
The compressed image is then piped to the split tool
The -b 2000m switch tells split how big to make the individual files. You can use k and m to tell switch kilobytes and megabytes (this option uses bytes by default).
The – option tells split to read from stdin. Otherwise, split would interpret the /mnt/hdc1… as the file to be split.
The /mnt/hdc1… is the prefix for the created files. Split will create files named backup.img.gz.aa, backup.img.gz.ab, etc.
To restore the multi-file backup, do the following:

# cat /mnt/sdc1/backup.img.gz.* | gzip -dc | dd of=/dev/sda1
Cat recombines contents of the compressed and split image files to stdout, in order.
Results are piped through gzip for decompression.
And are then written to the first partition of the hard drive with dd.

« Newer PostsOlder Posts »

Powered by WordPress