Gentoo Archives: gentoo-user

From: Michael Mol <mikemol@×××××.com>
To: gentoo-user@l.g.o
Subject: Moving partitionless (hypothetical) (Was: Re: [gentoo-user] Process to resize ext3 file system at the command line? )
Date: Thu, 17 Nov 2011 17:47:07
1 On Thu, Nov 17, 2011 at 12:25 PM, Neil Bothwick <neil@××××××××××.uk> wrote:
2 > On Thu, 17 Nov 2011 09:01:46 -0800, Mark Knecht wrote:
3 >
4 >>    I'm pretty sure I've got the command set right to do the RAID-1 to
5 >> RAID-5 conversion, but once it's done I believe the file system itself
6 >> will still be 250GB so I'll need to resize the file system. In the
7 >> past I've done this with gparted, which seems to work fine, but this
8 >> time I was considering doing it at the command line. Does anyone know
9 >> of a good web site that goes through how to do that? I've browsed
10 >> around and found different pages that talk about it but my reading
11 >> looks like they all have minor differences which leaves me a bit
12 >> worried.
13 >
14 > Using cfdisk or fdisk, delete the partition and recreate it, USING THE
15 > SAME START BLOCK at a larger size.
16 >
17 > Then "resize2fs /dev/sdwhatever" will resize the filesystem to fill the
18 > partition.
20 Silly question, but is there really a need for a partition in a
21 scenario like that? He could conceivably move the data to the
22 beginning of the block device, and then run resize2fs.
24 Less silly question: What would an effective means of moving the data
25 on-disk like that be? Something like:
27 dd if=/dev/md0 of=/dev/md0 skip=$count_of_blocks_to_get_to_fs_start
29 would do it, I think, since you wouldn't be overwriting any block
30 unless it was useless or already moved. Better not interrupt it unless
31 you can recalculate the skip and seek parameters, though.
33 That'd default to moving data 512 bytes at a time, though, which would
34 be slow and painful. You could do something like
36 dd if=/dev/md0 of=/dev/md0 skip=$fs_start count=$boundary_pos
37 dd if=/dev/md0 of=/dev/md0 bs=4M skip=$resume_read_pos seek=$resume_write_pos
39 where:
40 fs_start = # the block number to where the filesystem begins
41 boundary_pos = # how many increments of 512 bytes it would take to get
42 to a nice round number like 4M
43 resume_read_pos = # how many increments of 4MB it would take to get
44 back to where we left off reading
45 resume_write_pos = # how many increments of 4MB it would take to get
46 back to where we left off writing
48 I don't know what the exact values for these would be, though.
49 --
50 :wq