I’m assuming your system is a actual server without a GUI so the command line is all that you have
After posting earlier I went to fix supper for my wife. At which point it dawned on me that you posted on Ubuntu Forums before the shift over here.
- welcome here.
- If I recall correctly you had a working system on the linux box. and then a need arose and you pulled a drive from your array and transferred that drive to the other machine. Thus putting your array for a extended time in a degraded status. (so I’m thinking you basically had a mirror, which means both drives contained the data, but with you pulling one drive means all the data is now on just one drive
Lesson learned … Luckily all is actually not lost.
First put the new drive in … then type lsblk if I recall the details you shared it should show up as sdc.
As of right now the new drive is not mounted , partitioned or even formatted which means you can’t read write or access it. in order to do so… have no fear it is actually easy
partition the drive…
sudo fdisk /dev/sdc
once the command prompt returns
type “n” <<for new partition
then “p” or just press enter for primary
then it will ask for partition number just use 1 partition which is the default so you can type 1 or just press enter.
then you will see that fdisk is asking for type the default is linux just press enter at this point.
Once that is done look /check to ensure the partition is the way you desire. press p that will display the drive geometry if all looks well
then you can press w to write the changes that will cause fdisk to write the changes to the new drive, or you can press q to quit which will not write or change the drive allowing you to start all over again. but to save the changes you must write to the drive with the w command at the prompt.
once it completes the write press q to exit fdisk. this will leave you with a drive with 1 partition. type lsblk again now it will show sdc the direct below that sdc1 (the 1 is the partition)
now to format the partition
sudo mkfs.ext4 /dev/sdc1
this will be in a ext4 format readable by linux, not windows. (what I mean here is if you plugged the drive directly to your windows machine, not over a samba share it will be readable from a samba share)
if you desire to format in another format
typing sudo mkfs will display all available types of formatting that can be done.
just replace ext4 with your choice but I would stay with ext4 .
at this point we hace partitioned and formatted the drive the only thing left to do is mount it so we can copy your data… This part is easy
we have to have a mount point to mount /dev/sdc1 to
if you type sudo cd / this will put you in the root directory
type ls when in the root directory you should see a directory /mnt for ease of you and me let’s go there and make adirectory under there.
so
sudo cd /mnt
make a directory under /mnt
sudo mkdir save
now this makes a new mount point to mount sdc1 to, now we can mount it with
sudo mount /dev/sdc1 /mnt/save
outside the long and hopefully not so long copy process we are almost there.
Let’s go back to the home directory type
cd ~
~ is used for home in lieu of typing home / will get you to the root directory.
now because all drives must be mounted you have to know the mount point for the drive that was used with your “raid” or mirror sdb… aka where the data is in the directory as we are writing from one mount point (directory) to another mount point (directory)
Where that is will change the command below
sudo cp -r --verbose /where/thedata/is /mnt/save
/where/thedata/is = the actual directory of the data you want to save /mnt/save is the directory or mount point of the sdc1 drive…
sudo = superuser aka root
cp = copy
-r =means recursive so it will copy the directory structure exactly with all files
–verbose = simply causes it display progress as it writes … without it the screen stays blank until the write is completed.
Once completed you can unmount the drive and disconnect it preserving your data. but if youy desire to do this don’t be in the directory that the drive is mounted in or it will complain it is busy. The command to unmount a drive is easy
sudo umount /dev/sdc1 (or the drive you wish to take off line)
here you can remove the drive if that is your desire
As if I recall your break out I would completely redo your system and layout. And choose a simpler layout. If you desire a raid I would look at the linux default mdadm or even zfs, LVM is not a bad choice either. But they all require attention and must be maintained. If your not wanting to do that I would just mount the drives I planned on using to a mount point. It will show up in the system as a drive directory without drive redundancy … a directory as one big drive so to speak… If you desire redundancy research the differing ones (types of RAID Solutions) and pick one. But backup your data because RAID (Redundant Array Independent Disk) is not a backup. Many take offense to that statement and really shouldn’t. Nothing replaces backups except more back ups. RAID allows you to replace a drive that is failing. nothing more nothing less it must be coupled with backups.
It is not meant as nothing but advice.
at this point YOU can unmount the lvm contained in /etc/fstab and replace it with the new drive. By editing the /etc/fstab.