LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-29-2002, 02:29 PM   #1
verigoth
Member
 
Registered: May 2002
Posts: 179

Rep: Reputation: Disabled
resize a loopback file


Is there any way to resize a loopback file without having to create a new one? The information contained in the file is not an issue, it's user quotas in Windows. I cannot create more files, but I can resize existing ones. Any ideas?

verigoth
 
Old 10-30-2002, 09:20 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Well that kind of depends on what kind of filesystem is used for the loopback file. But each filesystems should have tools to get that done. Anyways here is how I did it for an ext2 filesystem:
Code:
# cd /tmp
# mkdir mnt
# dd if=/dev/zero of=image bs=1k count=1024
1024+0 records in
1024+0 records out
# mke2fs -i 1024 -b 1024 -m 5 -F -v image
mke2fs 1.24a (02-Sep-2001)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1024 inodes, 1024 blocks
51 blocks (4.98%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
1024 inodes per group

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
# mount image mnt -t ext2 -o loop
# dd if=/dev/zero of=image bs=1k count=1024 seek=1024
1024+0 records in
1024+0 records out
# e2fsck -f image
e2fsck 1.24a (02-Sep-2001)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

image: *** WARNING: Filesystem still has errors ***

image: 11/1024 files (0.0% non-contiguous), 135/1024 blocks
# resize2fs image 2048
resize2fs 1.24a (02-Sep-2001)
The filesystem on image is now 2048 blocks long.
# mount image mnt -t ext2 -o loop
# cd mnt
# df -k .
Filesystem           1k-blocks      Used Available Use% Mounted on
/tmp/image                1915         2      1852   1% /tmp/mnt
# cd ..  
# umount mnt 
# rm -rf mnt image
#
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Swap file & Boot Partition Resize surfer2k3 Linux - Newbie 4 07-17-2008 07:50 PM
Resize a file with a size of 0 smaudlin Linux - General 2 11-12-2005 12:33 AM
Resize a file seriesx4 Linux - General 2 10-23-2005 09:43 AM
dm_crypt, loopback file on a dvd jnorvell Linux - Security 11 08-01-2005 07:26 PM
How to grub install to a partition on an image file via a loopback Owen LaGarde Linux - Software 2 12-26-2003 09:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration