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 - 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 05-10-2021, 01:47 PM   #1
AdrianMorales
LQ Newbie
 
Registered: May 2021
Location: Spain
Distribution: ArchLinux
Posts: 20

Rep: Reputation: Disabled
Copy a partition into another hard disk with less size


I want to copy my /home partition to another hard disk, but this second has less size. How can I do it?
 
Old 05-10-2021, 02:18 PM   #2
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by AdrianMorales View Post
I want to copy my /home partition to another hard disk, but this second has less size. How can I do it?
Many options here, one of them is rsync...

Assuming you have created a partition on second disk, and even if it is smaller; hopefully still big enough for the data you want to migrate?

Code:
rsync <source> <destination>
Take a look at man page for rsync for some examples.
 
Old 05-10-2021, 02:55 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
If you need or wish to keep the partition the same then you copy file by file. Rsync and many other ways can copy file by file. We'd have to assume the total size of original files is less than new partition size otherwise you may need extra work.
 
Old 05-10-2021, 05:45 PM   #4
verndog
Member
 
Registered: Oct 2007
Posts: 278

Rep: Reputation: 67
If its partition to smaller partition and the partitions are not ntfs fsachiver will work.
 
Old 05-10-2021, 07:27 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
As long as the new parition is large enough to accommodate the directories and files to be copied, any standard method for copying files should work.
 
Old 05-10-2021, 07:40 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
If you really want to preserve metadata details like ctime timestamps, you could shrink the /home filesystem and then use tools like partclone or image copy to transfer the filesystem to the new partition. Note that shrinking has to be done with the filesystem unmounted, and is not possible for XFS.
 
Old 05-11-2021, 06:09 AM   #7
AdrianMorales
LQ Newbie
 
Registered: May 2021
Location: Spain
Distribution: ArchLinux
Posts: 20

Original Poster
Rep: Reputation: Disabled
Ok, thank u all. I will try with some of those tool
 
Old 05-12-2021, 11:00 AM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,647
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
You can also do this with LVM, which lets you create "physical storage pools" and assign them to "logical volumes" within those pools. In this way, what appears to the OS to be a single mount-point may actually occupy many drives and/or partitions. If one disk begins to fill up, you can simply add a new disk and add all or part of it to the storage pool. From the OS's point of view, the mount-point just got bigger.

To specifically address your current requirement, you can use the migration feature of LVM to move the data from one physical place to another, without downtime! Very useful when a hard drive starts to make "funny clicking noises."

Last edited by sundialsvcs; 05-12-2021 at 11:02 AM.
 
  


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
partition layout , hard disk name and hard disk size in single output ?? jheengut Linux - Software 1 11-03-2013 05:13 AM
Disk Space Used is Less Than Size Still Available Disk Space is Zero devUnix Linux - Server 10 10-04-2013 08:56 AM
Copy of IBM Server hard disk data to Another USB External Hard disk mazharcdn Linux - Server 2 09-02-2009 12:41 AM
Copy data from one hard disk to another hard disk vino87 Linux - Desktop 4 08-06-2009 11:37 PM
Total partition size - User partition size is not equals to Free partition size navaneethanj Linux - General 5 06-14-2004 12:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:22 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