LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Partitions: resize & move mixed types (https://www.linuxquestions.org/questions/linux-newbie-8/partitions-resize-and-move-mixed-types-4175529375/)

alfino 12-27-2014 08:49 PM

Partitions: resize & move mixed types
 
Greets

I'm using systemrescue, trying to resize two partitions on sda which runs Lenny in a small NAS. sda is 1.5TB which has about 500G of unused space after sda4.

Code:

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/md0      ext3  1004M  605M  348M  64% /
tmpfs        tmpfs    62M    0  62M  0% /lib/init/rw
udev        tmpfs    10M  696K  9.4M  7% /dev
tmpfs        tmpfs    62M    0  62M  0% /dev/shm
/dev/md2      ext3    494M  11M  458M  3% /mnt/md2
/dev/sda4      xfs    929G  295G  635G  32% /media/Data

My target is:
/dev/sda4 from ~929GB to the end of the physical disk

and /dev/md0 (root) from ~1GB to to ~5GB

I am currently making a direct copy of the disk to the exact same model empty disk using:
Code:

ddrescue --no-split /dev/sda /dev/sdb logfile
(it will take about 8hrs. Slightly OT: is there a faster way?)

Looking at gparted (using a different but similarly setup disk), it seems that when I resize sda4 and move it to the end of the disk, then shift sda3 and sda2 over "to the right", and resize sda1 to take the extra space (effectively enlarging it), there is always some "leftover" unallocated space between sda1 and sda2 (I don't care if there is space at beginning and end of the disk but i can't seem to eliminate the space in between).

Anyone know of any such way to eliminate the unallocated space? Some type of alignment that will work for these varied type paritions?

Thanks in advance

Doc CPU 12-28-2014 04:41 AM

Hi there,

Quote:

Originally Posted by alfino (Post 5291358)
Greets

I'm using systemrescue, trying to resize two partitions on sda which runs Lenny in a small NAS. sda is 1.5TB which has about 500G of unused space after sda4.

Code:

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/md0      ext3  1004M  605M  348M  64% /
tmpfs        tmpfs    62M    0  62M  0% /lib/init/rw
udev        tmpfs    10M  696K  9.4M  7% /dev
tmpfs        tmpfs    62M    0  62M  0% /dev/shm
/dev/md2      ext3    494M  11M  458M  3% /mnt/md2
/dev/sda4      xfs    929G  295G  635G  32% /media/Data


it would've told us more about the disk if you'd shown the output of 'fdisk -l' instead of the mountpoints. Specifically, what's the matter with sda1, sda2 and sda3?

Quote:

Originally Posted by alfino (Post 5291358)
Code:

ddrescue --no-split /dev/sda /dev/sdb logfile
(it will take about 8hrs. Slightly OT: is there a faster way?)

Hardly. Just do some basic math: Let's assume a disk-to-disk transfer rate of 100MB/s (which is very optimistic). That's 1GB in 10secs, or 1TB in 10'000secs, or 1.5TB in 15'000secs, which is slightly over 4 hours. Now assume a slightly lower, more realistic transfer rate, like, say, 60MB/s, and you're close to your 8 hour estimate.

Quote:

Originally Posted by alfino (Post 5291358)
Looking at gparted (using a different but similarly setup disk), it seems that when I resize sda4 and move it to the end of the disk, then shift sda3 and sda2 over "to the right", and resize sda1 to take the extra space (effectively enlarging it), there is always some "leftover" unallocated space between sda1 and sda2 (I don't care if there is space at beginning and end of the disk but i can't seem to eliminate the space in between).

Anyone know of any such way to eliminate the unallocated space? Some type of alignment that will work for these varied type paritions?

By default, gparted aligns partition boundaries to 1MB. However, if you just move partitions without resizing them (as I understand you're doing with sda2 and sda3), they may keep their "odd" boundaries, while the end of sda1 is aligned after resizing.

I don't know if that's the issue here; it's just a guess.

[X] Doc CPU

alfino 12-28-2014 08:24 PM

Quote:

Originally Posted by Doc CPU (Post 5291469)
Hi there,



it would've told us more about the disk if you'd shown the output of 'fdisk -l' instead of the mountpoints. Specifically, what's the matter with sda1, sda2 and sda3?

Sorry, they're configured as md devices. From the NAS:
Here's fdisk -l:
Code:

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              1      182402  1465138583+  ee  EFI GPT

Disk /dev/md0: 1068 MB, 1068892160 bytes
2 heads, 4 sectors/track, 260960 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md2: 533 MB, 533921792 bytes
2 heads, 4 sectors/track, 130352 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

Disk /dev/md1: 1069 MB, 1069875200 bytes
2 heads, 4 sectors/track, 261200 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

And here's parted:
Code:

Model: Seagate ST31500541AS (scsi)
Disk /dev/sda: 1500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End    Size    File system  Name    Flags
 1      100MB  1169MB  1069MB  ext3                  raid
 2      1169MB  2239MB  1070MB  linux-swap            raid
 3      2239MB  2773MB  534MB  ext3                  raid
 4      2773MB  1000GB  997GB  xfs          primary     


Model: Unknown (unknown)
Disk /dev/md1: 1070MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size    File system  Flags
 1      0.00B  1070MB  1070MB  linux-swap       


Model: Unknown (unknown)
Disk /dev/md2: 534MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size  File system  Flags
 1      0.00B  534MB  534MB  ext3             


Model: Unknown (unknown)
Disk /dev/md0: 1069MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size    File system  Flags
 1      0.00B  1069MB  1069MB  ext3             



                                                                         
Error: /dev/mtdblock6: unrecognised disk label


                                                                         
Error: /dev/mtdblock5: unrecognised disk label


                                                                         
Error: /dev/mtdblock4: unrecognised disk label


                                                                         
Error: /dev/mtdblock3: unrecognised disk label


                                                                         
Error: /dev/mtdblock2: unrecognised disk label


                                                                         
Error: /dev/mtdblock1: unrecognised disk label


                                                                         
Error: /dev/mtdblock0: unrecognised disk label

Quote:

Hardly. Just do some basic math: Let's assume a disk-to-disk transfer rate of 100MB/s (which is very optimistic). That's 1GB in 10secs, or 1TB in 10'000secs, or 1.5TB in 15'000secs, which is slightly over 4 hours. Now assume a slightly lower, more realistic transfer rate, like, say, 60MB/s, and you're close to your 8 hour estimate.
So it averaged about 51MB/s. 8+ hrs. Fine.

I had thought there'd be a faster way image the disk with some util, that would NOT waste time copying the "unused" bits on the disk. Perhaps that would be much more complicated than I assumed.

Quote:

By default, gparted aligns partition boundaries to 1MB. However, if you just move partitions without resizing them (as I understand you're doing with sda2 and sda3), they may keep their "odd" boundaries, while the end of sda1 is aligned after resizing.

I don't know if that's the issue here; it's just a guess.
OK. So perhaps there is no (simple) way to eliminate that little bit of unused space created..

rknichols 12-28-2014 11:05 PM

Quote:

Originally Posted by alfino (Post 5291763)
I had thought there'd be a faster way image the disk with some util, that would NOT waste time copying the "unused" bits on the disk.

Clonezilla and Partclone can do that. (Clonezilla uses Partclone under the hood.)
Quote:

OK. So perhaps there is no (simple) way to eliminate that little bit of unused space created..
Primary partitions can be back-to-back with no intermediate space if the sizes are integral numbers of MiB. Logical partitions within the extended partition each have a 1 sector partition header, so parted/gparted aligns the start to the next 1MiB boundary.

alfino 12-29-2014 12:43 AM

Quote:

Originally Posted by rknichols (Post 5291787)
Clonezilla and Partclone can do that. (Clonezilla uses Partclone under the hood.)

I'll look into clonezilla/partclone. Thanks.
Quote:

Primary partitions can be back-to-back with no intermediate space if the sizes are integral numbers of MiB. Logical partitions within the extended partition each have a 1 sector partition header, so parted/gparted aligns the start to the next 1MiB boundary.
Well, as you can see in my case, all the partitions are primary, so I'm not sure why manipulations in gparted cannot seem to eliminate that small amount of space. Odd.

alfino 12-29-2014 02:33 PM

well, it didn't quite work. Good thing I'm working on the copy.

After resizing and moving sda4 (the xfs part), gparted errored on sda3, complaining device busy.

I realized that the md device was actually auto-started by the OS so I stopped it and re-opened gparted and moved it over to the right.

I had similar issues with sda2, and sda1, but eventually got it done, HOWEVER, none of the raid partitions (md0, md1, md2) were showing in the parted --list or proc/mdstat.

I tried to issue a mdadm -Cv to recreate the arrays, but then parted showed the array (eg. md0) with unknown label and unknown partition type.

So, I guess I'm missing some steps required to successfully move/resize RAID md array partitions.

If anyone can suggest a HOWTO or some helpful links, it'd be much appreciated.


All times are GMT -5. The time now is 05:42 PM.