LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-27-2014, 09:49 PM   #1
alfino
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Rep: Reputation: Disabled
Question 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
 
Old 12-28-2014, 05:41 AM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by alfino View Post
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 View Post
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 View Post
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
 
Old 12-28-2014, 09:24 PM   #3
alfino
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Doc CPU View Post
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..
 
Old 12-29-2014, 12:05 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,957

Rep: Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267
Quote:
Originally Posted by alfino View Post
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.
 
Old 12-29-2014, 01:43 AM   #5
alfino
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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.

Last edited by alfino; 12-29-2014 at 01:46 AM.
 
Old 12-29-2014, 03:33 PM   #6
alfino
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
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.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
superblock is corrupt after attempted resize & move of ext3 partition ktat Linux - Hardware 2 01-14-2011 05:23 AM
LXer: How To Resize RAID Partitions (Shrink & Grow) (Software RAID) LXer Syndicated Linux News 1 05-01-2009 01:02 PM
LXer: How To Resize LVM Software RAID1 Partitions (Shrink & Grow) LXer Syndicated Linux News 0 01-09-2009 03:11 PM
sys/types.h & linux/types.h conflict while compiling johnnyhal Linux - Software 1 12-28-2008 07:39 PM
XCDRoast -- mixed drive types DavidPhillips Linux - General 3 03-04-2002 11:20 PM


All times are GMT -5. The time now is 09:02 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration