Adding new drive without formatting

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :-)

Moderator: Moderators

Adding new drive without formatting

Postby mc_crafty » Thu Apr 17, 2014 9:30

To start, I'm running a Sabayon system that was first installed a couple years ago. This means I don't have any LVM set-up yet.

I have been using a 3TB for a media drive, but that happens to fill quickly. I have a second 3TB drive that I've added to my rig. I want to use both drives under one mount point with combined space, essentially giving me 6TB under a single mount with all the data from my initial media drive still intact.

I've looked into setting up LVM, but this requires a format of the mapped drives after they've been combined. Same goes for a RAID-0. If there is anyway to do either of these while retaining my initial drives information, that would probably be best.

Buying an extra drive to use as a bridge, or any other way of backing up the initial data, before reformatting is kind out of the question. A full 3TB would require yet another 3TB drive that I don't have funds for, and any other form of media would be more of a hassle than using two mount points and just using symlinks on the initial drive to the new one.

Any ideas or thoughts are welcome. Discussion helps find answers.

Thanks!

[edit] as this deals with both hardware and the software managing it, I thought it'd be best to go here. Mods feel free to move as needed
mc_crafty
Baby Hen
 
Posts: 5
Joined: Tue Jul 16, 2013 6:35

Re: Adding new drive without formatting

Postby Stupot » Thu Apr 17, 2014 16:17

I don't know of any way to format a drive and save the data on the drive without copying somewhere first. I don't think you can do what you're looking to do without another 3 TB hard drive to use temporarily. Maybe someone else will know of some magic trick I don't though.
Stupot
Sagely Hen
 
Posts: 1545
Joined: Wed Feb 14, 2007 3:44
Location: St. Louis, MO, USA

Re: Adding new drive without formatting

Postby totedati » Thu Apr 17, 2014 16:49

well, as a quick logic flow you can

1. connect you new drive to be ... /dev/sdc !?
2. make an mbr with fdisk
3. add only that new disk to a new lvm physical volume with an command like
Code: Select all
pvcreate --verbose /dev/sdc1


4. then a new volume group using that lvm physical volume:
Code: Select all
vgcreate --verbose what_a_crafty /dev/sdc1


5. then a logical volume in your new volume group:
Code: Select all
lvcreate --verbose --name my_new_3t_hdd --readahead auto --extents 100%VG what_a_crafty


6. then format that logical volume with one real fs, ext4 or btrfs?

Code: Select all
mkfs -t ext4 /dev/what_a_crafty/my_new_3t_hdd


mount, copy all infos from old to new hdd, unmount, then again, if you old hdd is /dev/sdb, i mean is not your os boot hdd only a big fat hdd for music and movies and et cetera you will repeat step 3, lvm physical volume, with /dev/sdb1 then at volume group step you will do a vgextend instead of vgcreate:

Code: Select all
vgextend --verbose what_a_crafty /dev/sdb1


then ofcourse

Code: Select all
lvextend --verbose --extents 100%VG /dev/what_a_crafty/my_new_3t_hdd


now you have a formated partition who fill only half of all available logical partition size, wich is now doubled ... what to do next!? of course, extend that formated partition! for this the tool needed is fsadm:
fsadm utility checks or resizes the filesystem on a device. It tries
to use the same API for ext2, ext3, ext4, ReiserFS and XFS
filesystem.


Code: Select all
fsadm --ext-offline --verbose /dev/what_a_crafty/my_new_3t_hdd


and thats it all ... if you bootable os files is also in that old 3Tb hdd, which i suspect will be now /dev/sda, you need to do an extra step, to install linux on your new hdd, add the old hdd as an extra hdd, /dev/sda will be the new hdd and /dev/sdb the old hdd, and just make the same logical steps:
make a new pv, make a new vg using the pv, put in vg an lv, format that lv, add a new physical disk, make a new pv, extend the old vg adding the new pv to it, extend the old lv, extend the fs from the old vg

Code: Select all
pv = lvm physical volume
vg = lvm volume group
lv = lvm logical volume


and any formatted and real fs will be inside an lv ... this is the beauty of lvm, that its logic is clear and simple ... i hear that btrfs is simply better but for me btrfs logic is still somewhat confusing, no separation between pv/vg/lv, you mount one pv btrfs formatted and automagically all pv+vg+lv+fs logic is here, available and mounted, you make a raid10 and you get a doubled space in df instead a halved one, in dolphin i do not see one mounted btrfs fs but all four pv partitions listed as devices and so on ... for me is still confusing :bounce:

and because is not me who discovered first this recipe, i need to disclose some of my info sources:
techrepublic.com - How to use Logical Volume Manager (LVM) to grow etx4 file systems online

as you can see, all news is already old :cyclopsani:
linux is free, the expertise to harness it is not!
you don't make so much money selling open source software!
You make MORE money USING it, just like google!
linux registered user #352479
totedati
Technological Hen
 
Posts: 417
Joined: Thu Jan 11, 2007 0:24
Location: Sibiu, Romania

Re: Adding new drive without formatting

Postby mc_crafty » Fri Apr 18, 2014 7:29

Thanks a lot for your reply. I didn't even think about using lvm on the new drive and using that as the data bridge. Clearly I have a lot more reading to do on lvm! Hopefully this copy won't take a million days... haha.
mc_crafty
Baby Hen
 
Posts: 5
Joined: Tue Jul 16, 2013 6:35

Re: Adding new drive without formatting

Postby totedati » Fri Apr 18, 2014 15:12

well we all wish you good luck, because you will do it without any backup ... if you successfully manage to do that, lvm partition management will look like spaceship rocket science vs. good and old mbr or gpt partition shuffling

and if you will really fall in true love with lvm you can skip the mbr thing altogether for data only hdd's!

Code: Select all
pvcreate --verbose /dev/sdc


is an equally valid comand! with no mbr! using hdd space at its maximum height

don't forget to post back to us you real results after this massive data shuffling!
:lol:
linux is free, the expertise to harness it is not!
you don't make so much money selling open source software!
You make MORE money USING it, just like google!
linux registered user #352479
totedati
Technological Hen
 
Posts: 417
Joined: Thu Jan 11, 2007 0:24
Location: Sibiu, Romania

Re: Adding new drive without formatting

Postby mc_crafty » Sun Jun 01, 2014 5:04

Finally got around to getting this done. Work has been crazy lately so this took longer than I would have liked. Thanks to my 6GB/s HDDs (non SSD) for only taking about 4-6 hours to copy a full 3TB, I'm able to post my results during the same day of the data transfer.

Everything worked just as expected with the exception of having to run fsck -f on the new lv before I could resize and having to specify resize in the fsadm command. I think this will be my first step to moving to a full lvm setup. Just for an example, after I made the lv for my new drive, it had an extra 100.5GB of usable space as compared to my gpt partition. That's a huge difference when you consider I'm using two identical drives...
mc_crafty
Baby Hen
 
Posts: 5
Joined: Tue Jul 16, 2013 6:35

Re: Adding new drive without formatting

Postby totedati » Sun Jun 01, 2014 13:24

Image
yaaay!
linux is free, the expertise to harness it is not!
you don't make so much money selling open source software!
You make MORE money USING it, just like google!
linux registered user #352479
totedati
Technological Hen
 
Posts: 417
Joined: Thu Jan 11, 2007 0:24
Location: Sibiu, Romania


Return to Beginners|Newbies Area

Who is online

Users browsing this forum: No registered users and 1 guest