Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Mount has the option offset to specify that a file system does not start at the beginning of a device but some specific amount of bytes after. How can I use resize2fs, which does not have that option, to resize such a file system which does not start at the device's beginning?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The offset option of mount does not get passed to mount directly, but to losetup which sets up a loop device which refers to the offsetted location of the underlaying block device. Mount then performs its operations on that loop device rather than the raw block device itself.

You can also use losetup to make resize2fs play which such file systems:

# losetup --offset=<offset> --find --show /dev/<device>
/dev/loop0
# resize2fs /dev/loop0 <newsize>
# losetup --detach /dev/loop0

(Example may not be complete in means of resize2fs operations)

losetup searchs for the first free loop device (in that example /dev/loop0) as --find was passed. --show outputs that loop device to STDOUT.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.