LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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-02-2010, 03:27 AM   #1
ethereal1m
Member
 
Registered: Jan 2010
Distribution: slackware 13.0 64
Posts: 259

Rep: Reputation: 30
Question Create a Softlink to Move some Library Folder


Dear all,
I'm running out of disk space in root, so I decide to move /usr/lib64 directory to other partition by creating moving the whole directory to new location and create a softlink in the old location. What I'm planning to do is:
1. Copy the whole directory to new location
2. Make sure if there's no problem in the copy process
3. Create a softlink in the old location pointing to the new location.

However, when I'm comparing the old location and the new location using du command, there's some discrepancies between those two where the new location contain bigger size than the old one. How is this possible?

Is this the proper way to save disk space by creating a softlink?

Regards,
ethereal1m
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 12-02-2010, 09:52 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Wouldn't it make more sense just to resize partitions? Or are you worried about data loss?
 
1 members found this post helpful.
Old 12-02-2010, 11:40 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by ethereal1m View Post
Dear all,
I'm running out of disk space in root, so I decide to move /usr/lib64 directory to other partition by creating moving the whole directory to new location and create a softlink in the old location. What I'm planning to do is:
1. Copy the whole directory to new location
2. Make sure if there's no problem in the copy process
3. Create a softlink in the old location pointing to the new location.
Your approach sounds mostly OK, but:
  1. What fs are you using on the destination? You need to make sure that the destination fs is compatible with the posix permissions scheme (i.e. not vfat, ntfs or something like that)
  2. How are you copying the file? Make sure you preserve permissions and ownerships. If you use "mv" there shouldn't be any problem, though I advise you to use "cp -a" instead. Don't delete the original copy until you make sure everything is working ok.

Quote:
However, when I'm comparing the old location and the new location using du command, there's some discrepancies between those two where the new location contain bigger size than the old one. How is this possible?
I don't know how "du" measures the space. But if it relies on the fs then that could be the cause. The block size can differ from one volume to another depending on the fs-type, the size and the options you used to format (and even to mount) them.

Quote:
Is this the proper way to save disk space by creating a softlink?
You could also mount the partition directly at /usr/lib64, or if it's a subdirectory in an already mounted volume, you could use "mount -o bind". To automate that you can use /etc/fstab, of course.
 
1 members found this post helpful.
Old 12-03-2010, 02:45 AM   #4
ethereal1m
Member
 
Registered: Jan 2010
Distribution: slackware 13.0 64
Posts: 259

Original Poster
Rep: Reputation: 30
@snark, hmm I'm considering the option...

@i92guboj,
1. I move files from ext4 to xfs file system not sure if this a problem
2. I'm using "cp -R". Is this ok?

hmm,the discrepancy df output is probably because the different file system types (ext4 and XFS) maybe?

Let me take a look at mount and fstab option...
 
Old 12-03-2010, 04:31 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by ethereal1m View Post
@snark, hmm I'm considering the option...

@i92guboj,
1. I move files from ext4 to xfs file system not sure if this a problem
xfs is ok.

Quote:
2. I'm using "cp -R". Is this ok?
Nope. -R copies recursively, but it doesn't preserve permissions nor ownerships, that can seriously screw up everything. You should use "cp -dR --preserve=all" or just "cp -a", which is equivalent.

Quote:
hmm,the discrepancy df output is probably because the different file system types (ext4 and XFS) maybe?
I can't be sure, but it's a possibility. If you want to copy with error checking use "rsync -a" instead.
 
2 members found this post helpful.
Old 12-15-2010, 02:16 AM   #6
ethereal1m
Member
 
Registered: Jan 2010
Distribution: slackware 13.0 64
Posts: 259

Original Poster
Rep: Reputation: 30
Thanks for all, you guys are awesome!
This works great!

sorry for the late reply...

regards,
ethereal1m
 
  


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
Help create a softlink gate Linux - Newbie 1 03-20-2009 11:39 PM
How to automatically move files from one folder into another folder? xmrkite Linux - Software 6 11-05-2006 11:39 AM
i move my /etc folder in my /home folder Casanogab Linux - Newbie 8 03-31-2006 02:21 PM
Cannot create Linux softlink on smbfs neqboan Linux - General 0 07-30-2003 03:21 PM


All times are GMT -5. The time now is 10:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration