Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ext4 and online resize[SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Tue May 08, 2012 1:55 pm    Post subject: ext4 and online resize[SOLVED] Reply with quote

Hi,

I came across this http://www.linuxtoday.com/high_performance/2012011200941OSKN and wondering which gentoo kernel version has this feature in it.

This is what I see available on my Gentoo box(x86_64).

eix gentoo-sources
Code:
[D] sys-kernel/gentoo-sources
     Available versions: 
   (2.6.32-r29)   2.6.32-r29!b!s
   (2.6.32-r39)   ~2.6.32-r39!b!s
   (2.6.32-r40)   ~2.6.32-r40!b!s
   (2.6.32-r41)   ~2.6.32-r41!b!s
   (3.0.17-r2)   3.0.17-r2!b!s
   (3.0.26)   ~3.0.26!b!s
   (3.0.29)   ~3.0.29!b!s
   (3.1.10-r1)   3.1.10-r1!b!s
   (3.2.1-r2)   3.2.1-r2!b!s
   (3.2.12)   3.2.12!b!s
   (3.2.14)   ~3.2.14!b!s
   (3.2.16)   ~3.2.16!b!s
   (3.3.0)   ~3.3.0!b!s
   (3.3.1)   ~3.3.1!b!s
   (3.3.2)   ~3.3.2!b!s
   (3.3.3)   ~3.3.3!b!s
   (3.3.4)   ~3.3.4!b!s
   {build deblob symlink}
     Installed versions:  2.6.38-r6(2.6.38-r6)!b!s(11:50:24 PM 06/24/2011)(-build -deblob -symlink) 2.6.39-r3(2.6.39-r3)!b!s(11:00:47 AM 07/18/2011)(-build -deblob -symlink) 3.0.3(3.0.3)!b!s(10:21:22 AM 08/18/2011)(-build -deblob -symlink) 3.0.6(3.0.6)!b!s(12:04:12 PM 12/07/2011)(-build -deblob -symlink) 3.1.6(3.1.6)!b!s(12:23:42 PM 01/25/2012)(symlink -build -deblob) 3.2.1-r2(3.2.1-r2)!b!s(10:02:43 AM 01/26/2012)(-build -deblob -symlink) 3.2.12(3.2.12)!b!s(04:09:22 PM 03/27/2012)(-build -deblob -symlink)
     Homepage:            http://dev.gentoo.org/~mpagano/genpatches
     Description:         Full sources including the Gentoo patchset for the 3.3 kernel tree


Last edited by upengan78 on Thu May 24, 2012 5:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Tue May 08, 2012 6:19 pm    Post subject: Reply with quote

Well, any 3.3.x should work. Also, since this is quite new (and in constant movement), make sure you get the latest e2fsprogs as well. Then just use resize2fs. You shouldn't need anything else.

In any case, I'd just create a loopback fs into a tiny file, format it with ext4, and do the tests in there, before you get into the real thing.

And, of course.... make backups.
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Tue May 08, 2012 6:27 pm    Post subject: Reply with quote

Cool..thanks for that info and tips. Will give it a try soon..
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Fri May 18, 2012 9:24 pm    Post subject: Reply with quote

So I compiled a new kernel - 3.3.5 and rebooted.

Code:
name -r
3.3.5-gentoo



Loop back device creation:
Code:
apple@tree.com ~ # cd /nfs1
apple@tree.com nfs1 # dd if=/dev/zero of=ext4.img bs=1024 count=470000
470000+0 records in
470000+0 records out
481280000 bytes (481 MB) copied, 2.2023 s, 219 MB/s
apple@tree.com nfs1 # losetup /dev/loop1 /nfs1/ext4.img


Ext4FS creation on the device:
Code:

apple@tree.com nfs1 # mkfs.ext4 /dev/loop1
mke2fs 1.42 (29-Nov-2011)
Discarding device blocks: done                           
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
117856 inodes, 470000 blocks
23500 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
58 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
   8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Allocating group tables: done                           
Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done


Mounted the FS and copied a random file to the mounted to FS:
Code:
apple@tree.com nfs1 # mkdir /mnt/text4
apple@tree.com nfs1 # mount -t auto /dev/loop1 /mnt/text4/
apple@tree.com nfs1 # cp yEd-3.8.sh /mnt/text4/


Running Resize2fs: Getting error
Code:
apple@tree.com nfs1 # resize2fs -p /dev/loop1 100M
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/loop1 is mounted on /mnt/text4; on-line resizing required
resize2fs: On-line shrinking not supported


Where did I go wrong?

EDIT: e2fsprogs
eix e2fsprogs
Code:
[I] sys-fs/e2fsprogs
     Available versions:  [M]~1.41.7-r1 1.41.12 ~1.41.12-r1 1.41.14 1.42 ~1.42.1 {elibc_FreeBSD nls static-libs}
     Installed versions:  1.42(11:33:12 AM 02/23/2012)(nls -elibc_FreeBSD -static-libs)
     Homepage:            http://e2fsprogs.sourceforge.net/
     Description:         Standard EXT2/EXT3/EXT4 filesystem utilities

Code:
[I] sys-libs/e2fsprogs-libs
     Available versions:  [M]~1.41.7 1.41.12 1.41.14 1.42 ~1.42.1 {nls static-libs}
     Installed versions:  1.42(10:44:17 AM 02/23/2012)(nls -static-libs)
     Homepage:            http://e2fsprogs.sourceforge.net/
     Description:         e2fsprogs libraries (common error and subsystem)
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sat May 19, 2012 8:14 am    Post subject: Reply with quote

You didn't do anything wrong. "resize" is not exactly the same than "shrink". "resize" can be "shink" or "grow". You can grow an fs on-line, but you can't "shrink" it, at least for now.
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Wed May 23, 2012 9:43 pm    Post subject: Reply with quote

OK. Thanks.
Thinking about growing ext4 now. So I thought I 'd create a small size partiton in loopback device and grow it to the loopback device size. Is it possible?

I gave it a try. Got stuck at a partition in lopback device. I can create a partition like this,
Code:


fdisk /dev/loop1

Command (m for help): p

Disk /dev/loop1: 481 MB, 481280000 bytes
160 heads, 6 sectors/track, 979 cylinders, total 940000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbb3c272b

      Device Boot      Start         End      Blocks   Id  System
/dev/loop1p1            2048      411647      204800   83  Linux


but I can't mkfs.ext4 /dev/loop1p1 <-- there is only /dev/loop1 not /dev/loop1p1 . I am stuck.

Any way to get this going?
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Wed May 23, 2012 10:13 pm    Post subject: Reply with quote

You need to use loopback devices here. I googled quickly and found this, which will save me some writting :lol:

http://wiki.osdev.org/Loopback_Device

It's not difficult, just don't be scared by the offsets.
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Wed May 23, 2012 10:34 pm    Post subject: Reply with quote

i92guboj wrote:
You need to use loopback devices here. I googled quickly and found this, which will save me some writting :lol:

http://wiki.osdev.org/Loopback_Device

It's not difficult, just don't be scared by the offsets.


Well, thanks but thatdoes look scary. Will give it a try for sure and let you know how that goes.

Thanks again!
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Wed May 23, 2012 10:57 pm    Post subject: Reply with quote

Got it. Looks like it worked.

df -kh
Code:
Filesystem             Size  Used Avail Use% Mounted on
/dev/loop0              99M   52M   43M  55% /mnt/text4

# resize2fs /dev/loop0
Code:
resize2fs 1.42.1 (17-Feb-2012)
Filesystem at /dev/loop0 is mounted on /mnt/text4; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/loop0 is now 503872 blocks long.


# df -kh
Code:
Filesystem             Size  Used Avail Use% Mounted on
/dev/loop0             489M   63M  406M  14% /mnt/text4



Thanks very much again.
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Wed May 23, 2012 11:34 pm    Post subject: Reply with quote

You are welcome.

This kind of stuff can look scary at first sight, but to me picking an offset is not too different from picking a graphic line in gparted and dragging it somewhere to resize a partition or create it. But that's maybe because I've been using text interfaces for a longer time than I've been using GUIs ;)

By the way, now that you know the right way to do it, I can tell you that gparted can also partition loopback files without all this paraphernalia. :lol:
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Wed May 23, 2012 11:41 pm    Post subject: Reply with quote

i92guboj wrote:
You are welcome.

This kind of stuff can look scary at first sight, but to me picking an offset is not too different from picking a graphic line in gparted and dragging it somewhere to resize a partition or create it. But that's maybe because I've been using text interfaces for a longer time than I've been using GUIs ;)

By the way, now that you know the right way to do it, I can tell you that gparted can also partition loopback files without all this paraphernalia. :lol:



YOU!! Why you didn't tell me that before! :x

:lol:
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Thu May 24, 2012 6:43 am    Post subject: Reply with quote

I saw you were decided to use fdisk and to learn, and didn't want to spoil the fun of it :lol:
Back to top
View user's profile Send private message
upengan78
l33t
l33t


Joined: 27 Jun 2007
Posts: 711
Location: IL

PostPosted: Thu May 24, 2012 2:01 pm    Post subject: Reply with quote

i92guboj wrote:
I saw you were decided to use fdisk and to learn, and didn't want to spoil the fun of it :lol:


Yeah, right. Thanks!!

Actually, my experience with fdisk was only upto choosing letters in fdisk's interface and letting it do everything. I am not too comfortable when it comes to CHS stuff. Is there a place where I can read about CHS stuff , MBR and this all in relation to linux file systems..I am always confused about these things as different file systems have different implementations but once I know what to look for and what tool may help in such cases(where data starts, are CHS numbers shown in fdisk correct, what they mean, etc..), I will be in better position then.

It is only when playing with loopback drive partitions I am seeing such a long fdisk command :D

Thanks again!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum