Move path /images
-
Hi,
OS : Debian
Fog Version : 1.5.10I need to change the location of my images on my second disk.
Thanks for your help.
-
@ITRecords You need to be a bit more descriptive of the problem you have.
Also provide the output of these commands.
lsblk
df -h
cat /etc/exports
Is this a physical server or virtual?
-
Hi @george1421
Thanks for the response.
you are right it is better to have the right information
- I installed fog on a vm
- here is the result
I want my images to be on the sdb1 disk
-
@ITRecords OK very good. That gives me enough of a picture to help out.
Are you linux familiar or no?
I thought I had a tutorial on it but I didn’t add the part if FOG was already installed. https://forums.fogproject.org/topic/11048/moving-fog-s-images-files-off-the-root-partition-2017-edition
The workflow here will be (You might want to make a snapshot/backup of your fog server. There is a potential ~5% you could lose your images if these steps are not followed correctly)
- Add your new VMDK file (you have it already with /dev/sdb1)
- Now make a temp mount point to connect your /dev/sdb1 to
mkdir -P /tmp/img2
- Lets just make a flag file so we can know a future step works
touch /tmp/img2/fog.txt
Prove that we can see the flag filels -la /tmp/img2
- Create a partition on the disk. You have already done this since you have /dev/sdb1
- Now you need to format the partition with a linux disk format. (I can’t tell from the screen shot if its done or not)
mkfs.ext4 /dev/sdb1
- Mount this new parttion onto the mount point we created before.
mount /dev/sdb1 /tmp/img2
- Now that the mount is complete (and because the /dev/sdb1 partition is blank we should not see the flag file when we list that directory.
ls -la /tmp/img2
(you should not see the flag file since the new disk is mounted over the top of /tmp/img2 - If everything is good here, again run the
df -h
command. Note the utilization of /dev/sda1 in GB. When we run that command you should see the value will be lower in /dev/sda1 and appear in /dev/sdb1 - Lets move your current images to the new drive
mv -vf /images/* /tmp/img2
(you should see a verbose output as all of your images and associated files are moved over to your new disk. - Once the move is done confirm that the files are in the new path /tmp/img2
ls -la /tmp/img2
(You should now see files in this directory, confirm you can see files that start with a period)
df -h
(this should now show that /dev/sda1 size should have decreased by the size of /dev/sdb1)
ls -la /images
(this directory should now be empty) - If everything is good lets unmount /dev/sdb1
umount /tmp/img2
- Now of a small monetary ($$) contribution I’ll tell you how to get your images back.
- Just kidding, The last step is to mount your /dev/sdb1 to the /images directory (just like we did in the beginning). Lets edit /etc/fstab. Add the following line to the fstab file
/dev/sdb1 /images ext4 defaults 0 1
Now save and exit the fstab file. - Last step is to tell linux to mount /dev/sdb1 onto /images.
mount -a
- If everything worked you should be able to list /images and see all of your files again.
ls -la /images
- Running
df -h
will now show that your root directory ( / ) is mounted on /dev/sda1 and ( /images ) is mounted on /dev/sdb1 - If you took a snapshot of the VM in the beginning go ahead and commit the changes.
- You are done.
-
@george1421 Great. thank you for these very detailed steps
- I’m doing pretty well on linux.
when I prepared my vm I added this disk without the mounted and in without formatted
Now you need to format the partition with a linux disk format. (I can’t tell from the screen shot if its done or not) mkfs.ext4 /dev/sdb1
I will test this today. I’ll keep you informed
-
-
@george1421 I would have no permission problem to bring with chmod to write my images. I will take my test tomorrow morning
-
Hi @george1421,
here is my return. I made my capture this afternoon.
towards the end of my capture I got this message
if you have an idea
-
@ITRecords That’s a permission issue.
So in /images/dev do you see a directory name that looks like a mac address?
-
@george1421 i test this morning. Thanks
-
@george1421 I gave the rights to the frogproject user again and it worked, however I encountered this error during my clone
-
@ITRecords
At least in previous versions, it was necessary to create a hidden file in /images and /images/dev called .mntcheck$touch /images/.mntcheck
$touch /images/dev/.mntcheckIn my server it shows up (ls -la) as :
-rwxwrwxrwx fogproject root 0 jan 8 2019 .mntcheck -
@ITRecords for right now lets execute these two commands.
Pause that for one second: Lets make sure the /images is still mounted on /dev/sdb1. Check the
df -h
command if /dev/sdb1 is still mounted over /images then continue on.Rerun the fog installer, that should fix the permissions on the directory. I would rather have the fog installer script fix things than brute force a permission on everything.
IF that doesn’t work then run these commands:
lets make sure the files are owned by fogproject.
chown -R fogproject.fogproject /images
chmod -R 775 /images
That should reset the permissions…
-
@george1421 i test a new tomorrow.
Thank you so much. It’s very nice to be able to count on you.
Thank for information @luilly23
-
This post is deleted! -
I disabled the function in the power options the fast startup
during my deployment I added a set username and set password in the fog.deployimage.
Thanks