LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-08-2010, 03:27 PM   #1
amol28kulkarni
LQ Newbie
 
Registered: Jan 2009
Posts: 11

Rep: Reputation: 0
Lightbulb Shrink my partition to new disk


I want to backup my partitions by shrinking it my issue is like
I want to create a new disk copy from only the used blocks I my current image.
How would I redirect the output of resize2fs to new disk and dd the current
partition so that I can boot my new image without issues and also without touching my current image and copying over of only the required data.

I understand that I can copy the entire disk and then resize the cloned disk but this seems inefficient as not all my disk is being used.
I dont want to hinder the current working disk manipulations on this should be avoided as I dont have any other backup.

So suppose I have a 2TB disk of which only 100GB is being used I need only these 100GB in the new disk. Is there any way of copying the used blocks in the existing filesystem to the new filesystem ?

Any pointer or clear ideas would be really useful. I appreciate this if I get some list of commands or steps and doing this without any software.
 
Old 10-08-2010, 03:36 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Not exactly what you asked for, but how about (1) making a partition on your new disk (with your tool of choice, fdisk for example) if you don't already have one, then (2) backing up with rsync -avH /old_data_path /path_to_backup_partition. That should result in a bootable backup (works for me).
 
Old 10-08-2010, 03:59 PM   #3
amol28kulkarni
LQ Newbie
 
Registered: Jan 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Hi Thanks for reply
Does rsync manage size on disk and different partition sizes. I got low disk capacity and hence
different partition table on both disks.
 
Old 10-08-2010, 05:43 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
rsync doesn't care about partitions. If the target filesystem isn't big enough, eventually the copy will fail. Else you will have a valid copy.
 
Old 10-09-2010, 01:57 PM   #5
amol28kulkarni
LQ Newbie
 
Registered: Jan 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Would it be efficient to copy entire data, is there any way to just copy over the blocks and adjust them according to the newly created filesystem ?
Would rsync be able to handle the corrupted data like dd can handle since dd does a blind copy. Is there a way of like creating another sparse image file of 2TB then copying over only required data blocks there which will exclude the empty blocks and then resizing the sparse image to 200GB.
 
  


Reply



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
shrink LVM partition bcbotha Fedora 4 06-09-2009 05:00 PM
shrink root partition kickdgrass Linux - General 5 02-04-2009 06:03 AM
shrink ext3 partition ZaphyR Linux - Software 2 04-23-2007 03:39 PM
I can't shrink my empty partition yeehi Linux - General 3 10-20-2004 02:23 PM
Can you shrink a partition? ericcarlson Linux - Software 1 01-22-2002 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 09:54 AM.

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
Open Source Consulting | Domain Registration