- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Linux: Move data to a new smaller LUN
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2010 06:16 AM
тАО06-08-2010 06:16 AM
Linux: Move data to a new smaller LUN
We have a 150GB LUN that only 6GB are used and needed. Therefore, a 20GB LUN has been presented to the system and we have to move the data from the 150GB to the 20GB.
Any suggestions on how to do this? I know with HP-UX we always mirrored and then broke the mirrors...but when I did that it was always to a LUN of equal size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2010 06:36 AM
тАО06-08-2010 06:36 AM
Re: Linux: Move data to a new smaller LUN
Make a new mount point and copy everything from the old to the new. Unmount both the old and the new file system.
Fix the fstab to mount the new smaller file system where the old large one was. Then fix the fstab to mount the old large one to a temporary name (like old_mount). Then remount both of them, and make sure same number of files, etc. Then make sure you've got the new smaller one where the old used to be, and restart your applications.
The get rid of the old mount, lvol, LUN (if desired), etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2010 06:49 AM
тАО06-08-2010 06:49 AM
Re: Linux: Move data to a new smaller LUN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2010 06:57 AM
тАО06-08-2010 06:57 AM
Re: Linux: Move data to a new smaller LUN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2010 10:51 AM
тАО06-08-2010 10:51 AM
Re: Linux: Move data to a new smaller LUN
dd will work.
apps down though.
If its a cooked file system and apps are down cp -rp will work.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2010 03:31 PM
тАО06-08-2010 03:31 PM
Re: Linux: Move data to a new smaller LUN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2010 08:49 PM
тАО06-08-2010 08:49 PM
Re: Linux: Move data to a new smaller LUN
Linux ext2/ext3 filesystems have an actual filesystem name, but it isn't usually visible to the users or normal applications at all. You can use "tune2fs -L" to change it while the filesystem is not mounted.
But I guess you meant the mount point name, or the volume group name.
Keeping the same mount point name is rather simple:
1.) mount the new LUN to a temporary location, for example /mnt
2.) use "cp -a" or equivalent to copy the data from the old LUN to the filesystem in the temporary location
3.) Set the ownership and permissions of /mnt to match the ownership and permissions to match the old mountpoint.
4.) unmount the old LUN and the new LUN
5.) edit /etc/fstab so that the new LUN automatically mounts into the old mountpoint instead of the old LUN
6.) mount the new LUN into the old mountpoint: the users and applications should see all files exactly as before.
7.) if you need to do any clean-up, you can mount the old LUN to a temporary location; or you can just un-present it if you don't need it any more.
If the problem is the VG name, it can be solved by using the "vgrename" command. A VG must be deactivated first (unmount all filesystems, vgchange -a n
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2010 11:43 AM
тАО06-11-2010 11:43 AM
Re: Linux: Move data to a new smaller LUN
If so
pvcreate /dev/newlun
vgextend your_vg /dev/newlun
pvmove /dev/oldlun /dev/newlun
vgreduce your_vg /dev/oldlun
pvremove /dev/oldlun.
If you are not using LVM then the best option is to:
1) Stop apps/db/anything using files on the old filesystem
2) format a similar filesystem on the new lun
3) Mount the new lun to some dir (like /mnt/newfs) and make sure it has the same perms as the old filesystem.
4) Use rsync to copy the files:
rsync -avzp /old_fs /mnt/newfs
5) umount both the old and new filesystems
6) modify /etc/fstab so the filesystem points to the new lun
7) mount the new filesystem on the correct mountpoint.
8) start your apps
9) Be happy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2010 12:24 PM
тАО06-11-2010 12:24 PM
Re: Linux: Move data to a new smaller LUN
It occurred to me that you could use resize2fs to reduce the file system size. You could then use lvreduce on the logical volume and get it the same size as the new target disk.
This would open up many more replication options.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com